Auto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obk

Enable the SimplifyArmIdentity MIR optimization at mir-opt-level=1

r? `@ghost`
This commit is contained in:
bors 2020-09-08 09:27:23 +00:00
commit 5a6b426e34
2 changed files with 9 additions and 11 deletions

View File

@ -367,11 +367,7 @@ fn optimization_applies<'tcx>(
}
impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
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;
}
fn run_pass(&self, _tcx: TyCtxt<'tcx>, source: MirSource<'tcx>, body: &mut Body<'tcx>) {
trace!("running SimplifyArmIdentity on {:?}", source);
let local_uses = LocalUseCounter::get_local_uses(body);
let (basic_blocks, local_decls, debug_info) =

View File

@ -18,7 +18,8 @@
debug tail => _4; // in scope 1 at $DIR/simplify_try_if_let.rs:23:18: 23:26
let _8: std::ptr::NonNull<Node>; // in scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
scope 2 {
debug other_head => _8; // in scope 2 at $DIR/simplify_try_if_let.rs:26:29: 26:39
- debug other_head => _8; // in scope 2 at $DIR/simplify_try_if_let.rs:26:29: 26:39
+ debug other_head => ((_9 as Some).0: std::ptr::NonNull<Node>); // in scope 2 at $DIR/simplify_try_if_let.rs:26:29: 26:39
scope 3 {
}
}
@ -65,11 +66,12 @@
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
- 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(_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