Skip to content

Commit

Permalink
Auto merge of #96601 - tmiasko:ssa-rpo, r=davidtwco
Browse files Browse the repository at this point in the history
Use reverse postorder in `non_ssa_locals`

The reverse postorder, unlike preorder, is now cached inside the MIR
body. Code generation uses reverse postorder anyway, so it might be
a small perf improvement to use it here as well.
  • Loading branch information
bors committed May 3, 2022
2 parents ea5fa17 + fa41852 commit e1df625
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/mir/analyze.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
}

// If there exists a local definition that dominates all uses of that local,
// the definition should be visited first. Traverse blocks in preorder which
// the definition should be visited first. Traverse blocks in an order that
// is a topological sort of dominance partial order.
for (bb, data) in traversal::preorder(&mir) {
for (bb, data) in traversal::reverse_postorder(&mir) {
analyzer.visit_basic_block_data(bb, data);
}

Expand Down

0 comments on commit e1df625

Please sign in to comment.