1
Fork 0

Auto merge of #74839 - alarsyo:multiple_return_terminators, r=oli-obk

Implement multiple return terminator optimization

Closes #72022
This commit is contained in:
bors 2020-10-01 09:52:58 +00:00
commit 9cba260df0
12 changed files with 150 additions and 123 deletions

View file

@ -33,6 +33,7 @@ pub mod inline;
pub mod instcombine; pub mod instcombine;
pub mod instrument_coverage; pub mod instrument_coverage;
pub mod match_branches; pub mod match_branches;
pub mod multiple_return_terminators;
pub mod no_landing_pads; pub mod no_landing_pads;
pub mod nrvo; pub mod nrvo;
pub mod promote_consts; pub mod promote_consts;
@ -464,6 +465,7 @@ fn run_optimization_passes<'tcx>(
&remove_unneeded_drops::RemoveUnneededDrops, &remove_unneeded_drops::RemoveUnneededDrops,
&match_branches::MatchBranchSimplification, &match_branches::MatchBranchSimplification,
// inst combine is after MatchBranchSimplification to clean up Ne(_1, false) // inst combine is after MatchBranchSimplification to clean up Ne(_1, false)
&multiple_return_terminators::MultipleReturnTerminators,
&instcombine::InstCombine, &instcombine::InstCombine,
&const_prop::ConstProp, &const_prop::ConstProp,
&simplify_branches::SimplifyBranches::new("after-const-prop"), &simplify_branches::SimplifyBranches::new("after-const-prop"),
@ -478,6 +480,7 @@ fn run_optimization_passes<'tcx>(
&simplify::SimplifyCfg::new("final"), &simplify::SimplifyCfg::new("final"),
&nrvo::RenameReturnPlace, &nrvo::RenameReturnPlace,
&simplify::SimplifyLocals, &simplify::SimplifyLocals,
&multiple_return_terminators::MultipleReturnTerminators,
]; ];
// Optimizations to run even if mir optimizations have been disabled. // Optimizations to run even if mir optimizations have been disabled.

View file

@ -0,0 +1,38 @@
//! This pass removes jumps to basic blocks containing only a return, and replaces them with a
//! return instead.
use crate::transform::{simplify, MirPass, MirSource};
use rustc_index::bit_set::BitSet;
use rustc_middle::mir::*;
use rustc_middle::ty::TyCtxt;
pub struct MultipleReturnTerminators;
impl<'tcx> MirPass<'tcx> for MultipleReturnTerminators {
fn run_pass(&self, tcx: TyCtxt<'tcx>, _: MirSource<'tcx>, body: &mut Body<'tcx>) {
if tcx.sess.opts.debugging_opts.mir_opt_level < 3 {
return;
}
// find basic blocks with no statement and a return terminator
let mut bbs_simple_returns = BitSet::new_empty(body.basic_blocks().len());
let bbs = body.basic_blocks_mut();
for idx in bbs.indices() {
if bbs[idx].statements.is_empty()
&& bbs[idx].terminator().kind == TerminatorKind::Return
{
bbs_simple_returns.insert(idx);
}
}
for bb in bbs {
if let TerminatorKind::Goto { target } = bb.terminator().kind {
if bbs_simple_returns.contains(target) {
bb.terminator_mut().kind = TerminatorKind::Return;
}
}
}
simplify::remove_dead_blocks(body)
}
}

View file

@ -91,7 +91,7 @@
+ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + switchInt(move _35) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
} }
bb1: { bb1: {
@ -107,10 +107,9 @@
StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28 StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28
} }
+ bb2: { + bb2: {
@ -131,7 +130,7 @@
+ nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 + nop; // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ } + }
+ +
bb3: { bb3: {
@ -154,7 +153,7 @@
+ nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 + nop; // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
bb4: { bb4: {
@ -177,7 +176,7 @@
+ nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 + nop; // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
bb5: { bb5: {
@ -200,7 +199,7 @@
+ nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 + nop; // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 + nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
bb6: { bb6: {
@ -221,7 +220,11 @@
- StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 - StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
- StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 - StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
- StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 - StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
+ discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
+ return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 + return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
} }
@ -243,15 +246,10 @@
- StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 - StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
- StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 - StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
- StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 - StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 - }
+ discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 -
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 - bb8: {
+ nop; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
}
bb8: {
- StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 - StorageLive(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19
- _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19 - _22 = (((*(_4.0: &ViewportPercentageLength)) as Vmin).0: f32); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:16: 25:19
- StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33 - StorageLive(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:28: 25:33
@ -269,7 +267,7 @@
- StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 - StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
- StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 - StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
- StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 - StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
- } - }
- -
- bb9: { - bb9: {
@ -290,19 +288,15 @@
- StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 - StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
- StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 - StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
- StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 - StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
- } - }
- -
- bb10: { - bb10: {
- return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
- }
-
- bb11: {
- ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 - ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
- discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 - discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
- StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 - StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
- StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 - StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 - return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
+ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30
+ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30
} }

View file

@ -73,7 +73,7 @@
+ StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + StorageLive(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + _35 = Ne(_34, _11); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + StorageDead(_34); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
+ switchInt(move _35) -> [false: bb8, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18 + switchInt(move _35) -> [false: bb7, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:11: 23:18
} }
bb1: { bb1: {
@ -89,8 +89,7 @@
StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28 StorageDead(_33); // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:27: 27:28
StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28 return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28
+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:27:14: 27:28
} }
- bb3: { - bb3: {
@ -127,8 +126,8 @@
StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 StorageDead(_14); // scope 1 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 StorageDead(_13); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50 StorageDead(_12); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:49: 23:50
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
- bb7: { - bb7: {
@ -150,8 +149,8 @@
StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 StorageDead(_19); // scope 2 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 StorageDead(_18); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50 StorageDead(_17); // scope 0 at $DIR/early_otherwise_branch_68867.rs:24:49: 24:50
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
- bb8: { - bb8: {
@ -173,8 +172,8 @@
StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 StorageDead(_24); // scope 3 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 StorageDead(_23); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56 StorageDead(_22); // scope 0 at $DIR/early_otherwise_branch_68867.rs:25:55: 25:56
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
- bb9: { - bb9: {
@ -196,26 +195,20 @@
StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 StorageDead(_29); // scope 4 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 StorageDead(_28); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56 StorageDead(_27); // scope 0 at $DIR/early_otherwise_branch_68867.rs:26:55: 26:56
- goto -> bb11; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 - goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
+ goto -> bb7; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6 + goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:8: 28:6
} }
- bb10: { - bb10: {
+ bb6: { + bb6: {
return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
}
- bb11: {
+ bb7: {
((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 ((_0 as Ok).0: ViewportPercentageLength) = move _3; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7 discriminant(_0) = 0; // scope 0 at $DIR/early_otherwise_branch_68867.rs:22:5: 28:7
StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7 StorageDead(_3); // scope 0 at $DIR/early_otherwise_branch_68867.rs:28:6: 28:7
StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2 StorageDead(_4); // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:1: 29:2
- goto -> bb10; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2 return; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
+ goto -> bb6; // scope 0 at $DIR/early_otherwise_branch_68867.rs:29:2: 29:2
+ } + }
+ +
+ bb8: { + bb7: {
+ StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + StorageDead(_35); // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30
+ switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30 + switchInt(_11) -> [0_isize: bb2, 1_isize: bb3, 2_isize: bb4, 3_isize: bb5, otherwise: bb1]; // scope 0 at $DIR/early_otherwise_branch_68867.rs:23:21: 23:30
} }

View file

@ -106,7 +106,7 @@
_0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 return; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23
} }
bb2: { bb2: {
@ -153,14 +153,10 @@
StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_15) -> [false: bb4, otherwise: bb5]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL switchInt(_15) -> [false: bb3, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
} }
bb3: { bb3: {
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
}
bb4: {
_8 = const (); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _8 = const (); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
@ -170,10 +166,10 @@
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
} }
bb5: { bb4: {
StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
@ -224,24 +220,24 @@
StorageLive(_46); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_46); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_47 = _40; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _47 = _40; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_46 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _46 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb5; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
} }
bb6: { bb5: {
StorageDead(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_48); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_48); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_49 = _39; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _49 = _39; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb7; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb6; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
} }
bb7: { bb6: {
StorageDead(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
@ -260,24 +256,24 @@
StorageLive(_50); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_50); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_51 = _43; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _51 = _43; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_50 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _50 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb7; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
} }
bb8: { bb7: {
StorageDead(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_52); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_52); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_53 = _42; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _53 = _42; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb9; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb8; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
} }
bb9: { bb8: {
StorageDead(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL

View file

@ -106,7 +106,7 @@
_0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 _0 = const (); // scope 0 at $DIR/issue-73223.rs:4:17: 4:23
StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7 StorageDead(_2); // scope 0 at $DIR/issue-73223.rs:5:6: 5:7
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23 return; // scope 0 at $DIR/issue-73223.rs:4:17: 4:23
} }
bb2: { bb2: {
@ -153,14 +153,10 @@
StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_17); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _15 = Not(move _16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_16); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
switchInt(_15) -> [false: bb4, otherwise: bb5]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL switchInt(_15) -> [false: bb3, otherwise: bb4]; // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
} }
bb3: { bb3: {
return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
}
bb4: {
_8 = const (); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _8 = const (); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_15); // scope 4 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
StorageDead(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageDead(_14); // scope 3 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
@ -170,10 +166,10 @@
_0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2 _0 = const (); // scope 0 at $DIR/issue-73223.rs:1:11: 9:2
StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_6); // scope 1 at $DIR/issue-73223.rs:9:1: 9:2
StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2 StorageDead(_1); // scope 0 at $DIR/issue-73223.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2 return; // scope 0 at $DIR/issue-73223.rs:9:2: 9:2
} }
bb5: { bb4: {
StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_19); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_20); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL StorageLive(_21); // scope 4 at $SRC_DIR/std/src/macros.rs:LL:COL
@ -224,24 +220,24 @@
StorageLive(_46); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_46); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_47 = _40; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _47 = _40; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_46 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb6; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _46 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _47) -> bb5; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
} }
bb6: { bb5: {
StorageDead(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_47); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_48); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_48); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_49 = _39; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _49 = _39; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb7; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _48 = transmute::<&&i32, &core::fmt::Opaque>(move _49) -> bb6; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
} }
bb7: { bb6: {
StorageDead(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_49); // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_38.0: &core::fmt::Opaque) = move _48; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_38.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _46; // scope 7 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
@ -260,24 +256,24 @@
StorageLive(_50); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_50); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_51 = _43; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _51 = _43; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_50 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb8; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _50 = transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>(move _51) -> bb7; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) -> for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error> {std::intrinsics::transmute::<for<'r, 's, 't0> fn(&'r &i32, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>, for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>>}, val: Value(Scalar(<ZST>)) }
} }
bb8: { bb7: {
StorageDead(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_51); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_52); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_52); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
StorageLive(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageLive(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_53 = _42; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _53 = _42; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
_52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb9; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL _52 = transmute::<&&i32, &core::fmt::Opaque>(move _53) -> bb8; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// mir::Constant // mir::Constant
// + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL // + span: $SRC_DIR/core/src/fmt/mod.rs:LL:COL
// + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) } // + literal: Const { ty: unsafe extern "rust-intrinsic" fn(&&i32) -> &core::fmt::Opaque {std::intrinsics::transmute::<&&i32, &core::fmt::Opaque>}, val: Value(Scalar(<ZST>)) }
} }
bb9: { bb8: {
StorageDead(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL StorageDead(_53); // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_41.0: &core::fmt::Opaque) = move _52; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL
(_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL (_41.1: for<'r, 's, 't0> fn(&'r core::fmt::Opaque, &'s mut std::fmt::Formatter<'t0>) -> std::result::Result<(), std::fmt::Error>) = move _50; // scope 9 at $SRC_DIR/core/src/fmt/mod.rs:LL:COL

View file

@ -0,0 +1,14 @@
// compile-flags: -Z mir-opt-level=3
// EMIT_MIR multiple_return_terminators.test.MultipleReturnTerminators.diff
fn test(x: bool) {
if x {
// test
} else {
// test
}
}
fn main() {
test(true)
}

View file

@ -0,0 +1,30 @@
- // MIR for `test` before MultipleReturnTerminators
+ // MIR for `test` after MultipleReturnTerminators
fn test(_1: bool) -> () {
debug x => _1; // in scope 0 at $DIR/multiple_return_terminators.rs:4:9: 4:10
let mut _0: (); // return place in scope 0 at $DIR/multiple_return_terminators.rs:4:18: 4:18
let mut _2: bool; // in scope 0 at $DIR/multiple_return_terminators.rs:5:8: 5:9
bb0: {
StorageLive(_2); // scope 0 at $DIR/multiple_return_terminators.rs:5:8: 5:9
_2 = _1; // scope 0 at $DIR/multiple_return_terminators.rs:5:8: 5:9
switchInt(_2) -> [false: bb1, otherwise: bb2]; // scope 0 at $DIR/multiple_return_terminators.rs:5:5: 9:6
}
bb1: {
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:7:12: 9:6
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:5:5: 9:6
}
bb2: {
_0 = const (); // scope 0 at $DIR/multiple_return_terminators.rs:5:10: 7:6
goto -> bb3; // scope 0 at $DIR/multiple_return_terminators.rs:5:5: 9:6
}
bb3: {
StorageDead(_2); // scope 0 at $DIR/multiple_return_terminators.rs:10:1: 10:2
return; // scope 0 at $DIR/multiple_return_terminators.rs:10:2: 10:2
}
}

View file

@ -13,60 +13,35 @@
StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_2); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_3 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21 _3 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
_2 = Eq(_3, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _2 = Eq(_3, const 0_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb7; // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21 goto -> bb4; // scope 0 at $DIR/not_equal_false.rs:4:17: 4:21
} }
bb1: { bb1: {
_0 = const true; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46 _0 = const true; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
goto -> bb4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
} }
bb2: { bb2: {
_0 = const false; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
goto -> bb4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
}
bb3: {
StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL StorageLive(_4); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
_5 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45 _5 = discriminant(_1); // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
_4 = Eq(_5, const 1_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL _4 = Eq(_5, const 1_isize); // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb10; // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45 goto -> bb5; // scope 0 at $DIR/not_equal_false.rs:4:38: 4:45
} }
bb4: { bb3: {
StorageDead(_4); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46 StorageDead(_4); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46 StorageDead(_2); // scope 0 at $DIR/not_equal_false.rs:4:45: 4:46
return; // scope 0 at $DIR/not_equal_false.rs:5:2: 5:2 return; // scope 0 at $DIR/not_equal_false.rs:5:2: 5:2
} }
bb4: {
switchInt(move _2) -> [false: bb2, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
}
bb5: { bb5: {
_2 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb7; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb6: {
_2 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb7; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb7: {
switchInt(move _2) -> [false: bb3, otherwise: bb1]; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
}
bb8: {
_4 = const false; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb10; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb9: {
_4 = const true; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
goto -> bb10; // scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
}
bb10: {
- _0 = Ne(_4, const false); // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46 - _0 = Ne(_4, const false); // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
+ _0 = _4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46 + _0 = _4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
goto -> bb4; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46 goto -> bb3; // scope 0 at $DIR/not_equal_false.rs:4:5: 4:46
} }
} }

View file

@ -62,10 +62,6 @@
+ nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 + nop; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
+ nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 + nop; // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
} }
} }

View file

@ -67,7 +67,7 @@
- discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 - discriminant(_0) = 0; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
- StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:8:9: 8:10 - StorageDead(_11); // scope 1 at $DIR/simplify_try.rs:8:9: 8:10
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
} }
bb2: { bb2: {
@ -88,11 +88,7 @@
+ _0 = move _3; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL + _0 = move _3; // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb3; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15 return; // scope 0 at $DIR/simplify_try.rs:7:14: 7:15
}
bb3: {
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
} }
} }

View file

@ -52,10 +52,6 @@ fn try_identity(_1: std::result::Result<u32, i32>) -> std::result::Result<u32, i
_0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10 _0 = move _3; // scope 1 at $DIR/simplify_try.rs:8:5: 8:10
StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16 StorageDead(_3); // scope 0 at $DIR/simplify_try.rs:7:15: 7:16
StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2 StorageDead(_2); // scope 0 at $DIR/simplify_try.rs:9:1: 9:2
goto -> bb2; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
}
bb2: {
return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2 return; // scope 0 at $DIR/simplify_try.rs:9:2: 9:2
} }
} }