Skip to content

Commit fa41852

Browse files
committed
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.
1 parent f75d884 commit fa41852

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/rustc_codegen_ssa/src/mir/analyze.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ pub fn non_ssa_locals<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>>(
4040
}
4141

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

0 commit comments

Comments
 (0)