Skip to content

Commit a981863

Browse files
committed
Run terminator opt twice
1 parent a0b9500 commit a981863

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

src/librustc_mir/transform/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,7 @@ fn run_optimization_passes<'tcx>(
469469
&simplify::SimplifyCfg::new("final"),
470470
&nrvo::RenameReturnPlace,
471471
&simplify::SimplifyLocals,
472+
&multiple_return_terminators::MultipleReturnTerminators,
472473
];
473474

474475
// Optimizations to run even if mir optimizations have been disabled.

src/test/mir-opt/multiple_return_terminators.test.MultipleReturnTerminators.diff

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,25 @@
44
fn test(_1: bool) -> () {
55
debug x => _1; // in scope 0 at $DIR/multiple_return_terminators.rs:3:9: 3:10
66
let mut _0: (); // return place in scope 0 at $DIR/multiple_return_terminators.rs:3:18: 3:18
7-
let mut _2: bool; // in scope 0 at $DIR/multiple_return_terminators.rs:4:8: 4:9
87

98
bb0: {
10-
StorageLive(_2); // scope 0 at $DIR/multiple_return_terminators.rs:4:8: 4:9
11-
_2 = _1; // scope 0 at $DIR/multiple_return_terminators.rs:4:8: 4:9
12-
switchInt(_2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
9+
switchInt(_1) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
1310
}
1411

1512
bb1: {
1613
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:6:12: 8:6
17-
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
14+
- goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
15+
+ return; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
1816
}
1917

2018
bb2: {
2119
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:4:10: 6:6
22-
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
23-
}
24-
25-
bb3: {
26-
StorageDead(_2); // scope 0 at $DIR/multiple_return_terminators.rs:9:1: 9:2
27-
return; // scope 0 at $DIR/multiple_return_terminators.rs:9:2: 9:2
20+
- goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
21+
- }
22+
-
23+
- bb3: {
24+
- return; // scope 0 at $DIR/multiple_return_terminators.rs:9:2: 9:2
25+
+ return; // scope 0 at $DIR/multiple_return_terminators.rs:4:5: 8:6
2826
}
2927
}
3028

0 commit comments

Comments
 (0)