Disable the SimplifyArmIdentity pass on beta

This pass is buggy so I'm disabling it to fix a stable-to-beta
regression.

Related to #73223
This commit is contained in:
Wesley Wiser 2020-06-11 20:46:55 -04:00
parent a37c32e2d5
commit f1605834a5
8 changed files with 87 additions and 62 deletions

View File

@ -306,7 +306,11 @@ fn optimization_applies<'tcx>(
}
impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
fn run_pass(&self, _: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
fn run_pass(&self, tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
if tcx.sess.opts.debugging_opts.mir_opt_level < 2 {
return;
}
trace!("running SimplifyArmIdentity on {:?}", source);
let (basic_blocks, local_decls) = body.basic_blocks_and_local_decls_mut();
for bb in basic_blocks {

View File

@ -26,15 +26,14 @@
}
bb3: {
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
- _3 = ((_1 as Some).0: u8); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
- ((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
- discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
_3 = ((_1 as Some).0: u8); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
_4 = _3; // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
}

View File

@ -26,7 +26,14 @@
}
bb3: {
_0 = move _1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
_3 = ((_1 as Some).0: u8); // scope 0 at $DIR/simplify-arm.rs:11:14: 11:15
StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
_4 = _3; // scope 1 at $DIR/simplify-arm.rs:11:25: 11:26
((_0 as Some).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
discriminant(_0) = 1; // scope 1 at $DIR/simplify-arm.rs:11:20: 11:27
StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:11:26: 11:27
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:11:27: 11:28
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:10:5: 13:6
}

View File

@ -22,15 +22,14 @@
}
bb1: {
- StorageLive(_5); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
- _5 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
- StorageLive(_6); // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
- _6 = _5; // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
- ((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
- discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
- StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25
- StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26
+ _0 = move _1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
StorageLive(_5); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
_5 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
StorageLive(_6); // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
_6 = _5; // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25
StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
}
@ -39,15 +38,14 @@
}
bb3: {
- StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
- _3 = ((_1 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
- StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
- _4 = _3; // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
- ((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
- discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
- StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23
- StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24
+ _0 = move _1; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
_3 = ((_1 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
_4 = _3; // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
}

View File

@ -18,27 +18,38 @@
bb0: {
_2 = discriminant(_1); // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
- switchInt(move _2) -> [0isize: bb3, 1isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
+ goto -> bb1; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
switchInt(move _2) -> [0isize: bb3, 1isize: bb1, otherwise: bb2]; // scope 0 at $DIR/simplify-arm.rs:18:9: 18:14
}
bb1: {
- _0 = move _1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
- goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
- }
-
- bb2: {
- unreachable; // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
- }
-
- bb3: {
_0 = move _1; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
- goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
+ goto -> bb2; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
StorageLive(_5); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
_5 = ((_1 as Err).0: i32); // scope 0 at $DIR/simplify-arm.rs:19:13: 19:14
StorageLive(_6); // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
_6 = _5; // scope 2 at $DIR/simplify-arm.rs:19:23: 19:24
((_0 as Err).0: i32) = move _6; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
discriminant(_0) = 1; // scope 2 at $DIR/simplify-arm.rs:19:19: 19:25
StorageDead(_6); // scope 2 at $DIR/simplify-arm.rs:19:24: 19:25
StorageDead(_5); // scope 0 at $DIR/simplify-arm.rs:19:25: 19:26
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
}
- bb4: {
+ bb2: {
bb2: {
unreachable; // scope 0 at $DIR/simplify-arm.rs:17:11: 17:12
}
bb3: {
StorageLive(_3); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
_3 = ((_1 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:18:12: 18:13
StorageLive(_4); // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
_4 = _3; // scope 1 at $DIR/simplify-arm.rs:18:21: 18:22
((_0 as Ok).0: u8) = move _4; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:18:18: 18:23
StorageDead(_4); // scope 1 at $DIR/simplify-arm.rs:18:22: 18:23
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:18:23: 18:24
goto -> bb4; // scope 0 at $DIR/simplify-arm.rs:17:5: 20:6
}
bb4: {
return; // scope 0 at $DIR/simplify-arm.rs:21:2: 21:2
}
}

View File

@ -49,17 +49,16 @@
}
bb2: {
- StorageLive(_10); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
- _10 = ((_3 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
- _2 = _10; // scope 5 at $DIR/simplify-arm.rs:24:13: 24:15
- StorageDead(_10); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
+ _0 = move _3; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
StorageLive(_10); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
_10 = ((_3 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
_2 = _10; // scope 5 at $DIR/simplify-arm.rs:24:13: 24:15
StorageDead(_10); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
- StorageLive(_11); // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
- _11 = _2; // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
- ((_0 as Ok).0: u8) = move _11; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
- discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
- StorageDead(_11); // scope 1 at $DIR/simplify-arm.rs:25:9: 25:10
StorageLive(_11); // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
_11 = _2; // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
((_0 as Ok).0: u8) = move _11; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
StorageDead(_11); // scope 1 at $DIR/simplify-arm.rs:25:9: 25:10
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
goto -> bb5; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
}

View File

@ -49,8 +49,16 @@
}
bb2: {
_0 = move _3; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
StorageLive(_10); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
_10 = ((_3 as Ok).0: u8); // scope 0 at $DIR/simplify-arm.rs:24:13: 24:15
_2 = _10; // scope 5 at $DIR/simplify-arm.rs:24:13: 24:15
StorageDead(_10); // scope 0 at $DIR/simplify-arm.rs:24:14: 24:15
StorageDead(_3); // scope 0 at $DIR/simplify-arm.rs:24:15: 24:16
StorageLive(_11); // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
_11 = _2; // scope 1 at $DIR/simplify-arm.rs:25:8: 25:9
((_0 as Ok).0: u8) = move _11; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
discriminant(_0) = 0; // scope 1 at $DIR/simplify-arm.rs:25:5: 25:10
StorageDead(_11); // scope 1 at $DIR/simplify-arm.rs:25:9: 25:10
StorageDead(_2); // scope 0 at $DIR/simplify-arm.rs:26:1: 26:2
goto -> bb5; // scope 0 at $DIR/simplify-arm.rs:26:2: 26:2
}

View File

@ -80,12 +80,11 @@
StorageLive(_8); // scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
_8 = ((_5 as Some).0: std::ptr::NonNull<Node>); // scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
StorageLive(_9); // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
- StorageLive(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
- _10 = _8; // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
- ((_9 as Some).0: std::ptr::NonNull<Node>) = move _10; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
- discriminant(_9) = 1; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
- StorageDead(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:61: 28:62
+ _9 = move _5; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
StorageLive(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
_10 = _8; // scope 3 at $DIR/simplify_try_if_let.rs:28:51: 28:61
((_9 as Some).0: std::ptr::NonNull<Node>) = move _10; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
discriminant(_9) = 1; // scope 3 at $DIR/simplify_try_if_let.rs:28:46: 28:62
StorageDead(_10); // scope 3 at $DIR/simplify_try_if_let.rs:28:61: 28:62
StorageLive(_11); // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:38
StorageLive(_12); // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:29
_12 = &mut _4; // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:29