diff options
| author | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-05-01 00:00:00 +0000 |
|---|---|---|
| committer | Tomasz Miąsko <tomasz.miasko@gmail.com> | 2022-05-01 14:58:29 +0200 |
| commit | fa41852c7aa1fd7d85c48fe94fb9055d862e2960 (patch) | |
| tree | 9469cb8a29dda8e67ea29f879ab0d4a6b13bbc02 | |
| parent | f75d884046e07bb26edeaba9b8c982dc97485fd5 (diff) | |
| download | rust-fa41852c7aa1fd7d85c48fe94fb9055d862e2960.tar.gz rust-fa41852c7aa1fd7d85c48fe94fb9055d862e2960.zip | |
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.
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/mir/analyze.rs | 4 |
1 files 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 efb424af3ed..fa39e8dd247 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); } |
