From fa41852c7aa1fd7d85c48fe94fb9055d862e2960 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Sun, 1 May 2022 00:00:00 +0000 Subject: [PATCH] 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. --- compiler/rustc_codegen_ssa/src/mir/analyze.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_codegen_ssa/src/mir/analyze.rs b/compiler/rustc_codegen_ssa/src/mir/analyze.rs index efb424af3ed95..fa39e8dd247d5 100644 --- a/compiler/rustc_codegen_ssa/src/mir/analyze.rs +++ b/compiler/rustc_codegen_ssa/src/mir/analyze.rs @@ -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); }