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.
This commit is contained in:
Tomasz Miąsko 2022-05-01 00:00:00 +00:00
parent f75d884046
commit fa41852c7a

View File

@ -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);
}