diff options
| author | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-05-09 14:06:05 -0400 |
|---|---|---|
| committer | Mark Rousskov <mark.simulacrum@gmail.com> | 2021-12-06 15:05:22 -0500 |
| commit | 92186cb5c9228f64c7f7c832a0b61aa05e14802d (patch) | |
| tree | 3ba682ef915445c9dc98a070ce4c1bde306bac1f /compiler/rustc_data_structures/src/graph/dominators | |
| parent | 7379d24ebc1ed0bbd8f33b9767b1390ea1a7177d (diff) | |
| download | rust-92186cb5c9228f64c7f7c832a0b61aa05e14802d.tar.gz rust-92186cb5c9228f64c7f7c832a0b61aa05e14802d.zip | |
Avoid inserting into buckets if not necessary
Diffstat (limited to 'compiler/rustc_data_structures/src/graph/dominators')
| -rw-r--r-- | compiler/rustc_data_structures/src/graph/dominators/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_data_structures/src/graph/dominators/mod.rs b/compiler/rustc_data_structures/src/graph/dominators/mod.rs index 99119610f93..074b5a16c12 100644 --- a/compiler/rustc_data_structures/src/graph/dominators/mod.rs +++ b/compiler/rustc_data_structures/src/graph/dominators/mod.rs @@ -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. |
