Skip to content

Commit

Permalink
Avoid inserting into buckets if not necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark-Simulacrum committed Dec 6, 2021
1 parent 7379d24 commit 92186cb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_data_structures/src/graph/dominators/mod.rs
Expand Up @@ -91,7 +91,13 @@ fn dominators_given_rpo<G: ControlFlowGraph>(graph: G, rpo: &[G::Node]) -> Domin
}
// semi[w] is now semidominator(w).

bucket[semi[w]].push(w);
// Optimization: Do not insert into buckets if parent[w] = semi[w], as
// we then immediately know the idom.
if parent[w].unwrap() != semi[w] {
bucket[semi[w]].push(w);
} else {
idom[w] = parent[w].unwrap();
}

// Optimization: We share the parent array between processed and not
// processed elements; lastlinked represents the divider.
Expand Down

0 comments on commit 92186cb

Please sign in to comment.