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

This commit is contained in:
Wesley Wiser 2020-09-03 21:15:50 -04:00
parent 0d0f6b1130
commit 903c0399e7
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 { impl<'tcx> MirPass<'tcx> for SimplifyArmIdentity {
fn run_pass(&self, tcx: 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); trace!("running SimplifyArmIdentity on {:?}", source);
let local_uses = LocalUseCounter::get_local_uses(body); let local_uses = LocalUseCounter::get_local_uses(body);
let (basic_blocks, local_decls, debug_info) = 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 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 let _8: std::ptr::NonNull<Node>; // in scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39
scope 2 { 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 { scope 3 {
} }
} }
@ -65,11 +66,12 @@
StorageLive(_8); // scope 1 at $DIR/simplify_try_if_let.rs:26:29: 26:39 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 _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(_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 - 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 - _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 - ((_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 - 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 - 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(_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 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 _12 = &mut _4; // scope 3 at $DIR/simplify_try_if_let.rs:28:25: 28:29