Skip to content

Commit ab41023

Browse files
committed
Run branch cleanup after copy prop
1 parent ef4d1c4 commit ab41023

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

src/librustc_mir/transform/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ fn optimized_mir<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> &'tcx
285285
&simplify_branches::SimplifyBranches::new("after-const-prop"),
286286
&deaggregator::Deaggregator,
287287
&copy_prop::CopyPropagation,
288+
&simplify_branches::SimplifyBranches::new("after-copy-prop"),
288289
&remove_noop_landing_pads::RemoveNoopLandingPads,
289290
&simplify::SimplifyCfg::new("final"),
290291
&simplify::SimplifyLocals,

src/test/mir-opt/simplify_match.rs

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
fn main() {
2+
match { let x = false; x } {
3+
true => println!("hello world!"),
4+
false => {},
5+
}
6+
}
7+
8+
// END RUST SOURCE
9+
// START rustc.main.SimplifyBranches-after-copy-prop.before.mir
10+
// bb0: {
11+
// ...
12+
// switchInt(const false) -> [false: bb3, otherwise: bb1];
13+
// }
14+
// bb1: {
15+
// END rustc.main.SimplifyBranches-after-copy-prop.before.mir
16+
// START rustc.main.SimplifyBranches-after-copy-prop.after.mir
17+
// bb0: {
18+
// ...
19+
// goto -> bb3;
20+
// }
21+
// bb1: {
22+
// END rustc.main.SimplifyBranches-after-copy-prop.after.mir

0 commit comments

Comments
 (0)