Remove inlining cost of Deinit statements

This commit is contained in:
Jakob Degen 2022-04-11 10:23:33 -04:00
parent 48b01a0d0e
commit 2f03767eef
4 changed files with 268 additions and 113 deletions

View File

@ -369,6 +369,7 @@ impl<'tcx> Inliner<'tcx> {
match stmt.kind {
StatementKind::StorageLive(_)
| StatementKind::StorageDead(_)
| StatementKind::Deinit(_)
| StatementKind::Nop => {}
_ => cost += INSTR_COST,
}

View File

@ -15,15 +15,15 @@
scope 1 {
debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:29:9: 29:10
scope 2 {
scope 5 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _8; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _10: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug e => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
scope 7 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _12; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _17: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
scope 9 {
debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _18; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
}
}
}
@ -34,25 +34,33 @@
scope 4 {
}
}
scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _14: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _15: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
}
scope 7 {
debug e => _13; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_4 = _1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_3 = <Result<i32, i32> as Try>::branch(move _4) -> bb1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
// mir::Constant
// + span: $DIR/separate_const_switch.rs:29:8: 29:10
// + literal: Const { ty: fn(Result<i32, i32>) -> ControlFlow<<Result<i32, i32> as Try>::Residual, <Result<i32, i32> as Try>::Output> {<Result<i32, i32> as Try>::branch}, val: Value(Scalar(<ZST>)) }
StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
switchInt(move _10) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb1: {
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
switchInt(move _5) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
bb2: {
StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_9 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_2 = _9; // scope 4 at $DIR/separate_const_switch.rs:29:8: 29:10
@ -65,28 +73,73 @@
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
bb3: {
bb2: {
StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
_8 = _6; // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_10); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_10 = move ((_8 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_12 = move _10; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move _12; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
_16 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_17 = move _18; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:29:10: 29:11
StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:30:1: 30:2
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
bb3: {
StorageLive(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_13 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
_15 = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_14 as Err).0: i32) = move _15; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_14) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _14; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
- switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ _5 = const 1_isize; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ switchInt(const 1_isize) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
bb4: {
unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb5: {
StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_12 = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Continue).0: i32) = move _12; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
- switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ _5 = const 0_isize; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ switchInt(const 0_isize) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
}

View File

@ -6,55 +6,117 @@ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
let mut _2: i32; // in scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
let mut _3: std::ops::ControlFlow<std::result::Result<std::convert::Infallible, i32>, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
let mut _4: std::result::Result<i32, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
let mut _5: isize; // in scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
let _6: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
let mut _7: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
let _8: i32; // in scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
let _5: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
let mut _6: std::result::Result<std::convert::Infallible, i32>; // in scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
let _7: i32; // in scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
scope 1 {
debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:29:9: 29:10
debug residual => _5; // in scope 1 at $DIR/separate_const_switch.rs:29:9: 29:10
scope 2 {
scope 5 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _7; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _9: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _10: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug e => _9; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
scope 7 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _11; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _6; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let _14: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _15: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
scope 9 {
debug e => _14; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _16; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
}
}
}
}
}
scope 3 {
debug val => _8; // in scope 3 at $DIR/separate_const_switch.rs:29:8: 29:10
debug val => _7; // in scope 3 at $DIR/separate_const_switch.rs:29:8: 29:10
scope 4 {
}
}
scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _8: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _9: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _10: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug v => _9; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
}
scope 7 {
debug e => _11; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_4 = _1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_3 = <Result<i32, i32> as Try>::branch(move _4) -> bb1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
// mir::Constant
// + span: $DIR/separate_const_switch.rs:29:8: 29:10
// + literal: Const { ty: fn(Result<i32, i32>) -> ControlFlow<<Result<i32, i32> as Try>::Residual, <Result<i32, i32> as Try>::Output> {<Result<i32, i32> as Try>::branch}, val: Value(Scalar(<ZST>)) }
StorageLive(_8); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_8 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
switchInt(move _8) -> [0_isize: bb3, 1_isize: bb1, otherwise: bb2]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb1: {
StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
_13 = move _11; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_12 as Err).0: i32) = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_12) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_13); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _12; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
switchInt(move _5) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_5); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_5 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_6); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
_6 = _5; // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
_14 = move ((_6 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_16 = move _14; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_15 = move _16; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_16); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _15; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_15); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_14); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_6); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_5); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:29:10: 29:11
StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:30:1: 30:2
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
bb2: {
StorageLive(_8); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_8 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_2 = _8; // scope 4 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb3: {
StorageLive(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_9 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_10 = move _9; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Continue).0: i32) = move _10; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_8); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_7); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_7 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_2 = _7; // scope 4 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageDead(_7); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
Deinit(_0); // scope 0 at $DIR/separate_const_switch.rs:29:5: 29:11
((_0 as Ok).0: i32) = move _2; // scope 0 at $DIR/separate_const_switch.rs:29:5: 29:11
discriminant(_0) = 0; // scope 0 at $DIR/separate_const_switch.rs:29:5: 29:11
@ -62,28 +124,4 @@ fn identity(_1: Result<i32, i32>) -> Result<i32, i32> {
StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:30:1: 30:2
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
bb3: {
StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_7); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
_7 = _6; // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_9 = move ((_7 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move _9; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_10 = move _11; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _10; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_9); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_7); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:29:10: 29:11
StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:30:1: 30:2
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
}

View File

@ -15,15 +15,15 @@
scope 1 {
debug residual => _6; // in scope 1 at $DIR/separate_const_switch.rs:29:9: 29:10
scope 2 {
scope 5 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _8; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _10: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug e => _10; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
scope 7 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _12; // in scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _17: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
scope 9 {
debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
scope 10 (inlined <i32 as From<i32>>::from) { // at $SRC_DIR/core/src/result.rs:LL:COL
debug t => _18; // in scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
}
}
}
@ -34,25 +34,41 @@
scope 4 {
}
}
scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:29:8: 29:10
debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _14: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
let mut _15: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
scope 6 {
debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
}
scope 7 {
debug e => _13; // in scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
}
}
bb0: {
StorageLive(_2); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_4 = _1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:9
_3 = <Result<i32, i32> as Try>::branch(move _4) -> bb1; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
// mir::Constant
// + span: $DIR/separate_const_switch.rs:29:8: 29:10
// + literal: Const { ty: fn(Result<i32, i32>) -> ControlFlow<<Result<i32, i32> as Try>::Residual, <Result<i32, i32> as Try>::Output> {<Result<i32, i32> as Try>::branch}, val: Value(Scalar(<ZST>)) }
StorageLive(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- switchInt(move _10) -> [0_isize: bb6, 1_isize: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ switchInt(move _10) -> [0_isize: bb5, 1_isize: bb3, otherwise: bb4]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
bb1: {
StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
switchInt(move _5) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
bb2: {
- StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
- StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
- switchInt(move _5) -> [0_isize: bb2, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
- }
-
- bb2: {
StorageLive(_9); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_9 = ((_3 as Continue).0: i32); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
_2 = _9; // scope 4 at $DIR/separate_const_switch.rs:29:8: 29:10
@ -65,28 +81,75 @@
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
bb3: {
- bb3: {
+ bb2: {
StorageLive(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
_8 = _6; // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageLive(_10); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_10 = move ((_8 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_12 = move _10; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move _12; // scope 7 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_11); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_10); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
_16 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
_17 = move _18; // scope 10 at $SRC_DIR/core/src/convert/mod.rs:LL:COL
StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:29:10: 29:11
StorageDead(_3); // scope 0 at $DIR/separate_const_switch.rs:30:1: 30:2
return; // scope 0 at $DIR/separate_const_switch.rs:30:2: 30:2
}
- bb4: {
+ bb3: {
StorageLive(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_13 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
_15 = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_14 as Err).0: i32) = move _15; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_14) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _14; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
+ _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
- bb5: {
+ bb4: {
unreachable; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
}
- bb6: {
+ bb5: {
StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
_11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
_12 = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
((_3 as Continue).0: i32) = move _12; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
+ StorageDead(_10); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:29:9: 29:10
+ _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
+ switchInt(move _5) -> [0_isize: bb1, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:29:8: 29:10
}
}