Skip to content

Commit 02bbed7

Browse files
committed
Remove redundant Dominators::start_node field
1 parent 2b88be5 commit 02bbed7

File tree

1 file changed

+2
-3
lines changed
  • compiler/rustc_data_structures/src/graph/dominators

1 file changed

+2
-3
lines changed

compiler/rustc_data_structures/src/graph/dominators/mod.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ pub fn dominators<G: ControlFlowGraph>(graph: &G) -> Dominators<G::Node> {
245245

246246
let time = compute_access_time(start_node, &immediate_dominators);
247247

248-
Dominators { start_node, post_order_rank, immediate_dominators, time }
248+
Dominators { post_order_rank, immediate_dominators, time }
249249
}
250250

251251
/// Evaluate the link-eval virtual forest, providing the currently minimum semi
@@ -311,7 +311,6 @@ fn compress(
311311
/// Tracks the list of dominators for each node.
312312
#[derive(Clone, Debug)]
313313
pub struct Dominators<N: Idx> {
314-
start_node: N,
315314
post_order_rank: IndexVec<N, usize>,
316315
// Even though we track only the immediate dominator of each node, it's
317316
// possible to get its full list of dominators by looking up the dominator
@@ -323,7 +322,7 @@ pub struct Dominators<N: Idx> {
323322
impl<Node: Idx> Dominators<Node> {
324323
/// Returns true if node is reachable from the start node.
325324
pub fn is_reachable(&self, node: Node) -> bool {
326-
node == self.start_node || self.immediate_dominators[node].is_some()
325+
self.time[node].start != 0
327326
}
328327

329328
/// Returns the immediate dominator of node, if any.

0 commit comments

Comments
 (0)