Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e2bf4b9

Browse files
committedDec 13, 2022
Do one round of DestProp at mir-opt-level=2
1 parent ed97493 commit e2bf4b9

17 files changed

+216
-252
lines changed
 

‎compiler/rustc_mir_transform/src/dest_prop.rs

+17-9
Original file line numberDiff line numberDiff line change
@@ -149,15 +149,18 @@ pub struct DestinationPropagation;
149149

150150
impl<'tcx> MirPass<'tcx> for DestinationPropagation {
151151
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
152-
// For now, only run at MIR opt level 3. Two things need to be changed before this can be
153-
// turned on by default:
154-
// 1. Because of the overeager removal of storage statements, this can cause stack space
155-
// regressions. This opt is not the place to fix this though, it's a more general
156-
// problem in MIR.
157-
// 2. Despite being an overall perf improvement, this still causes a 30% regression in
158-
// keccak. We can temporarily fix this by bounding function size, but in the long term
159-
// we should fix this by being smarter about invalidating analysis results.
160-
sess.mir_opt_level() >= 3
152+
// This pass is technically enabled at MIR opt level 2, but in a reduced form.
153+
// At MIR opt level 2, we run a single round, and at MIR opt level 3 or greater we keep
154+
// running rounds until we reach a fixed point. Based on experimentation with the rustc
155+
// benchmark suite, the majority of the benefit from this pass comes from the first round,
156+
// though on some code it continues to find optimizations for >10 rounds.
157+
// It may be possible to enable multiple rounds at MIR opt level 2 by being more careful
158+
// about invalidating analysis results.
159+
//
160+
// Note that due to overeager removal of storage statements, this pass (particularly at MIR
161+
// opt level 3), can cause stack space regressions. This opt is not the place to fix this
162+
// though, it's a more general problem in MIR.
163+
sess.mir_opt_level() >= 2
161164
}
162165

163166
fn run_pass(&self, tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
@@ -236,6 +239,11 @@ impl<'tcx> MirPass<'tcx> for DestinationPropagation {
236239
round_count += 1;
237240

238241
apply_merges(body, tcx, &merges, &merged_locals);
242+
243+
// At MIR opt level 2, we only run one iteration.
244+
if tcx.sess.mir_opt_level() < 3 {
245+
break;
246+
}
239247
}
240248

241249
trace!(round_count);

‎src/test/codegen/fewer-names.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ pub fn sum(x: u32, y: u32) -> u32 {
1313

1414
// NO-LABEL: define{{.*}}i32 @sum(i32 %x, i32 %y)
1515
// NO-NEXT: start:
16-
// NO-NEXT: %z = add i32 %y, %x
17-
// NO-NEXT: ret i32 %z
16+
// NO-NEXT: %0 = add i32 %y, %x
17+
// NO-NEXT: ret i32 %0
1818
let z = x + y;
1919
z
2020
}

‎src/test/codegen/simd-intrinsic/simd-intrinsic-generic-arithmetic-saturating.rs

+83-83
Large diffs are not rendered by default.

‎src/test/codegen/simd-intrinsic/simd-intrinsic-generic-bitmask.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "platform-intrinsic" {
3535
// CHECK-LABEL: @bitmask_int
3636
#[no_mangle]
3737
pub unsafe fn bitmask_int(x: i32x2) -> u8 {
38-
// CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|_2}}, <i32 31, i32 31>
38+
// CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, <i32 31, i32 31>
3939
// CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1>
4040
// CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2
4141
// CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8
@@ -45,7 +45,7 @@ pub unsafe fn bitmask_int(x: i32x2) -> u8 {
4545
// CHECK-LABEL: @bitmask_uint
4646
#[no_mangle]
4747
pub unsafe fn bitmask_uint(x: u32x2) -> u8 {
48-
// CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|_2}}, <i32 31, i32 31>
48+
// CHECK: [[A:%[0-9]+]] = lshr <2 x i32> %{{x|1}}, <i32 31, i32 31>
4949
// CHECK: [[B:%[0-9]+]] = trunc <2 x i32> [[A]] to <2 x i1>
5050
// CHECK: [[C:%[0-9]+]] = bitcast <2 x i1> [[B]] to i2
5151
// CHECK: %{{[0-9]+}} = zext i2 [[C]] to i8
@@ -55,7 +55,7 @@ pub unsafe fn bitmask_uint(x: u32x2) -> u8 {
5555
// CHECK-LABEL: @bitmask_int16
5656
#[no_mangle]
5757
pub unsafe fn bitmask_int16(x: i8x16) -> u16 {
58-
// CHECK: [[A:%[0-9]+]] = lshr <16 x i8> %{{x|_2}}, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
58+
// CHECK: [[A:%[0-9]+]] = lshr <16 x i8> %{{x|2}}, <i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7, i8 7>
5959
// CHECK: [[B:%[0-9]+]] = trunc <16 x i8> [[A]] to <16 x i1>
6060
// CHECK: %{{[0-9]+}} = bitcast <16 x i1> [[B]] to i16
6161
// CHECK-NOT: zext

‎src/test/codegen/simd-intrinsic/simd-intrinsic-generic-extract-insert.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,27 @@ extern "platform-intrinsic" {
2121
// CHECK-LABEL: @extract_m
2222
#[no_mangle]
2323
pub unsafe fn extract_m(v: M, i: u32) -> f32 {
24-
// CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
24+
// CHECK: extractelement <4 x float> %{{v|2}}, i32 %i
2525
simd_extract(v, i)
2626
}
2727

2828
// CHECK-LABEL: @extract_s
2929
#[no_mangle]
3030
pub unsafe fn extract_s(v: S<4>, i: u32) -> f32 {
31-
// CHECK: extractelement <4 x float> %{{v|_3}}, i32 %i
31+
// CHECK: extractelement <4 x float> %{{v|2}}, i32 %i
3232
simd_extract(v, i)
3333
}
3434

3535
// CHECK-LABEL: @insert_m
3636
#[no_mangle]
3737
pub unsafe fn insert_m(v: M, i: u32, j: f32) -> M {
38-
// CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i
38+
// CHECK: insertelement <4 x float> %{{v|1}}, float %j, i32 %i
3939
simd_insert(v, i, j)
4040
}
4141

4242
// CHECK-LABEL: @insert_s
4343
#[no_mangle]
4444
pub unsafe fn insert_s(v: S<4>, i: u32, j: f32) -> S<4> {
45-
// CHECK: insertelement <4 x float> %{{v|_4}}, float %j, i32 %i
45+
// CHECK: insertelement <4 x float> %{{v|1}}, float %j, i32 %i
4646
simd_insert(v, i, j)
4747
}

‎src/test/codegen/simd-intrinsic/simd-intrinsic-transmute-array.rs

-3
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,20 @@ pub struct U(f32, f32, f32, f32);
2121
// CHECK-LABEL: @build_array_s
2222
#[no_mangle]
2323
pub fn build_array_s(x: [f32; 4]) -> S<4> {
24-
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
2524
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
2625
S::<4>(x)
2726
}
2827

2928
// CHECK-LABEL: @build_array_t
3029
#[no_mangle]
3130
pub fn build_array_t(x: [f32; 4]) -> T {
32-
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
3331
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
3432
T(x)
3533
}
3634

3735
// CHECK-LABEL: @build_array_u
3836
#[no_mangle]
3937
pub fn build_array_u(x: [f32; 4]) -> U {
40-
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
4138
// CHECK: call void @llvm.memcpy.{{.+}}({{.*}}, i{{[0-9]+}} 16, i1 false)
4239
unsafe { std::mem::transmute(x) }
4340
}

‎src/test/codegen/simd_arith_offset.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ pub struct Simd<T, const LANES: usize>([T; LANES]);
2121
// CHECK-LABEL: smoke
2222
#[no_mangle]
2323
pub fn smoke(ptrs: SimdConstPtr<u8, 8>, offsets: Simd<usize, 8>) -> SimdConstPtr<u8, 8> {
24-
// CHECK: getelementptr i8, <8 x {{i8\*|ptr}}> %_3, <8 x i64> %_4
24+
// CHECK: getelementptr i8, <8 x {{i8\*|ptr}}> %1, <8 x i64> %2
2525
unsafe { simd_arith_offset(ptrs, offsets) }
2626
}

‎src/test/codegen/var-names.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub fn test(a: u32, b: u32) -> u32 {
99
// CHECK: %c = add i32 %a, %b
1010
let d = c;
1111
let e = d * a;
12-
// CHECK-NEXT: %e = mul i32 %c, %a
12+
// CHECK-NEXT: %0 = mul i32 %c, %a
1313
e
14-
// CHECK-NEXT: ret i32 %e
14+
// CHECK-NEXT: ret i32 %0
1515
}

‎src/test/mir-opt/dataflow-const-prop/inherit_overflow.main.DataflowConstProp.diff

+4-12
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@
1111
scope 2 (inlined <u8 as Add>::add) { // at $DIR/inherit_overflow.rs:7:13: 7:47
1212
debug self => _2; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
1313
debug other => _3; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
14-
let mut _4: u8; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
15-
let mut _5: u8; // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
16-
let mut _6: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
14+
let mut _4: (u8, bool); // in scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
1715
}
1816

1917
bb0: {
@@ -22,19 +20,13 @@
2220
_2 = const u8::MAX; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
2321
StorageLive(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
2422
_3 = const 1_u8; // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
25-
StorageLive(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
26-
_4 = const u8::MAX; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
27-
StorageLive(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
28-
_5 = const 1_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
29-
_6 = CheckedAdd(const u8::MAX, const 1_u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
30-
assert(!move (_6.1: bool), "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
23+
_4 = CheckedAdd(const u8::MAX, const 1_u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
24+
assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> bb1; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
3125
}
3226

3327
bb1: {
34-
- _1 = move (_6.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
28+
- _1 = move (_4.0: u8); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
3529
+ _1 = const 0_u8; // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
36-
StorageDead(_5); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
37-
StorageDead(_4); // scope 2 at $SRC_DIR/core/src/ops/arith.rs:LL:COL
3830
StorageDead(_3); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
3931
StorageDead(_2); // scope 0 at $DIR/inherit_overflow.rs:+3:13: +3:47
4032
StorageDead(_1); // scope 0 at $DIR/inherit_overflow.rs:+3:47: +3:48

‎src/test/mir-opt/dest-prop/branch.foo.DestinationPropagation.diff

+4-6
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,18 @@
88
let _4: i32; // in scope 0 at $DIR/branch.rs:+6:9: +6:14
99
scope 1 {
1010
- debug x => _1; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
11-
+ debug x => _0; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
11+
+ debug x => _2; // in scope 1 at $DIR/branch.rs:+1:9: +1:10
1212
let _2: i32; // in scope 1 at $DIR/branch.rs:+3:9: +3:10
1313
scope 2 {
14-
- debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
15-
+ debug y => _0; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
14+
debug y => _2; // in scope 2 at $DIR/branch.rs:+3:9: +3:10
1615
}
1716
}
1817

1918
bb0: {
2019
- StorageLive(_1); // scope 0 at $DIR/branch.rs:+1:9: +1:10
2120
- _1 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
2221
+ nop; // scope 0 at $DIR/branch.rs:+1:9: +1:10
23-
+ _0 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
22+
+ _2 = val() -> bb1; // scope 0 at $DIR/branch.rs:+1:13: +1:18
2423
// mir::Constant
2524
// + span: $DIR/branch.rs:13:13: 13:16
2625
// + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
@@ -63,10 +62,9 @@
6362

6463
bb6: {
6564
StorageDead(_3); // scope 1 at $DIR/branch.rs:+8:5: +8:6
66-
- _0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6
65+
_0 = _2; // scope 2 at $DIR/branch.rs:+10:5: +10:6
6766
- StorageDead(_2); // scope 1 at $DIR/branch.rs:+11:1: +11:2
6867
- StorageDead(_1); // scope 0 at $DIR/branch.rs:+11:1: +11:2
69-
+ nop; // scope 2 at $DIR/branch.rs:+10:5: +10:6
7068
+ nop; // scope 1 at $DIR/branch.rs:+11:1: +11:2
7169
+ nop; // scope 0 at $DIR/branch.rs:+11:1: +11:2
7270
return; // scope 0 at $DIR/branch.rs:+11:2: +11:2

‎src/test/mir-opt/dest-prop/cycle.main.DestinationPropagation.diff

+11-15
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
let mut _6: i32; // in scope 0 at $DIR/cycle.rs:+6:10: +6:11
1010
scope 1 {
1111
- debug x => _1; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
12-
+ debug x => _6; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
12+
+ debug x => _4; // in scope 1 at $DIR/cycle.rs:+1:9: +1:14
1313
let _2: i32; // in scope 1 at $DIR/cycle.rs:+2:9: +2:10
1414
scope 2 {
1515
- debug y => _2; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
16-
+ debug y => _6; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
16+
+ debug y => _3; // in scope 2 at $DIR/cycle.rs:+2:9: +2:10
1717
let _3: i32; // in scope 2 at $DIR/cycle.rs:+3:9: +3:10
1818
scope 3 {
19-
- debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
20-
+ debug z => _6; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
19+
debug z => _3; // in scope 3 at $DIR/cycle.rs:+3:9: +3:10
2120
}
2221
}
2322
}
@@ -26,7 +25,7 @@
2625
- StorageLive(_1); // scope 0 at $DIR/cycle.rs:+1:9: +1:14
2726
- _1 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
2827
+ nop; // scope 0 at $DIR/cycle.rs:+1:9: +1:14
29-
+ _6 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
28+
+ _4 = val() -> bb1; // scope 0 at $DIR/cycle.rs:+1:17: +1:22
3029
// mir::Constant
3130
// + span: $DIR/cycle.rs:9:17: 9:20
3231
// + literal: Const { ty: fn() -> i32 {val}, val: Value(<ZST>) }
@@ -38,31 +37,28 @@
3837
- StorageLive(_3); // scope 2 at $DIR/cycle.rs:+3:9: +3:10
3938
- _3 = _2; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
4039
- StorageLive(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
41-
- _4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
42-
- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
43-
- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
4440
+ nop; // scope 1 at $DIR/cycle.rs:+2:9: +2:10
45-
+ nop; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
41+
+ _3 = _4; // scope 1 at $DIR/cycle.rs:+2:13: +2:14
4642
+ nop; // scope 2 at $DIR/cycle.rs:+3:9: +3:10
4743
+ nop; // scope 2 at $DIR/cycle.rs:+3:13: +3:14
4844
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
49-
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
45+
_4 = _3; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
46+
- _1 = move _4; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
47+
- StorageDead(_4); // scope 3 at $DIR/cycle.rs:+4:9: +4:10
5048
+ nop; // scope 3 at $DIR/cycle.rs:+4:5: +4:10
5149
+ nop; // scope 3 at $DIR/cycle.rs:+4:9: +4:10
5250
StorageLive(_5); // scope 3 at $DIR/cycle.rs:+6:5: +6:12
53-
- StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11
51+
StorageLive(_6); // scope 3 at $DIR/cycle.rs:+6:10: +6:11
5452
- _6 = _1; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
55-
+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
56-
+ nop; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
53+
+ _6 = _4; // scope 3 at $DIR/cycle.rs:+6:10: +6:11
5754
_5 = std::mem::drop::<i32>(move _6) -> bb2; // scope 3 at $DIR/cycle.rs:+6:5: +6:12
5855
// mir::Constant
5956
// + span: $DIR/cycle.rs:14:5: 14:9
6057
// + literal: Const { ty: fn(i32) {std::mem::drop::<i32>}, val: Value(<ZST>) }
6158
}
6259

6360
bb2: {
64-
- StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12
65-
+ nop; // scope 3 at $DIR/cycle.rs:+6:11: +6:12
61+
StorageDead(_6); // scope 3 at $DIR/cycle.rs:+6:11: +6:12
6662
StorageDead(_5); // scope 3 at $DIR/cycle.rs:+6:12: +6:13
6763
_0 = const (); // scope 0 at $DIR/cycle.rs:+0:11: +7:2
6864
- StorageDead(_3); // scope 2 at $DIR/cycle.rs:+7:1: +7:2

‎src/test/mir-opt/dest-prop/dead_stores_better.f.DestinationPropagation.after.mir

+5-8
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ fn f(_1: usize) -> usize {
88
let mut _4: usize; // in scope 0 at $DIR/dead_stores_better.rs:+4:8: +4:9
99
scope 1 {
1010
debug b => _1; // in scope 1 at $DIR/dead_stores_better.rs:+1:9: +1:10
11+
scope 2 (inlined id::<usize>) { // at $DIR/dead_stores_better.rs:16:5: 16:10
12+
debug x => _0; // in scope 2 at $DIR/dead_stores_better.rs:7:10: 7:11
13+
}
1114
}
1215

1316
bb0: {
@@ -19,14 +22,8 @@ fn f(_1: usize) -> usize {
1922
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:5: +3:10
2023
nop; // scope 1 at $DIR/dead_stores_better.rs:+3:9: +3:10
2124
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
22-
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
23-
_0 = id::<usize>(move _1) -> bb1; // scope 1 at $DIR/dead_stores_better.rs:+4:5: +4:10
24-
// mir::Constant
25-
// + span: $DIR/dead_stores_better.rs:16:5: 16:7
26-
// + literal: Const { ty: fn(usize) -> usize {id::<usize>}, val: Value(<ZST>) }
27-
}
28-
29-
bb1: {
25+
_0 = _1; // scope 1 at $DIR/dead_stores_better.rs:+4:8: +4:9
26+
nop; // scope 2 at $DIR/dead_stores_better.rs:8:5: 8:6
3027
nop; // scope 1 at $DIR/dead_stores_better.rs:+4:9: +4:10
3128
nop; // scope 0 at $DIR/dead_stores_better.rs:+5:1: +5:2
3229
return; // scope 0 at $DIR/dead_stores_better.rs:+5:2: +5:2

‎src/test/mir-opt/dest-prop/dead_stores_better.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// that that pass enables this one to do more optimizations.
33

44
// unit-test: DestinationPropagation
5-
// compile-flags: -Zmir-enable-passes=+DeadStoreElimination
5+
// compile-flags: -Zmir-opt-level=3 -Zmir-enable-passes=+DeadStoreElimination
66

77
fn id<T>(x: T) -> T {
88
x

‎src/test/mir-opt/inline/inline_generator.main.Inline.diff

+26-34
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,27 @@
77
let mut _2: std::pin::Pin<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:32
88
let mut _3: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:23: +1:31
99
let mut _4: [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 0 at $DIR/inline_generator.rs:+1:28: +1:31
10-
+ let mut _7: bool; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
10+
+ let mut _5: bool; // in scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
1111
scope 1 {
1212
debug _r => _1; // in scope 1 at $DIR/inline_generator.rs:+1:9: +1:11
1313
}
1414
+ scope 2 (inlined g) { // at $DIR/inline_generator.rs:9:28: 9:31
1515
+ }
1616
+ scope 3 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new) { // at $DIR/inline_generator.rs:9:14: 9:32
1717
+ debug pointer => _3; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
18-
+ let mut _5: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 3 at $SRC_DIR/core/src/pin.rs:LL:COL
1918
+ scope 4 {
2019
+ scope 5 (inlined Pin::<&mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>::new_unchecked) { // at $SRC_DIR/core/src/pin.rs:LL:COL
21-
+ debug pointer => _5; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
22-
+ let mut _6: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
20+
+ debug pointer => _3; // in scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
2321
+ }
2422
+ }
2523
+ }
2624
+ scope 6 (inlined g::{closure#0}) { // at $DIR/inline_generator.rs:9:14: 9:46
27-
+ debug a => _7; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
28-
+ let mut _8: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
29-
+ let mut _9: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
25+
+ debug a => _5; // in scope 6 at $DIR/inline_generator.rs:15:6: 15:7
26+
+ let mut _6: i32; // in scope 6 at $DIR/inline_generator.rs:15:17: 15:39
27+
+ let mut _7: u32; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
28+
+ let mut _8: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
29+
+ let mut _9: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
3030
+ let mut _10: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
31-
+ let mut _11: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
32-
+ let mut _12: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]; // in scope 6 at $DIR/inline_generator.rs:15:5: 15:41
3331
+ }
3432

3533
bb0: {
@@ -55,29 +53,23 @@
5553
- }
5654
-
5755
- bb2: {
58-
+ StorageLive(_5); // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
59-
+ _5 = move _3; // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
60-
+ StorageLive(_6); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
61-
+ _6 = move _5; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
6256
+ Deinit(_2); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
63-
+ (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) = move _6; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
64-
+ StorageDead(_6); // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
65-
+ StorageDead(_5); // scope 4 at $SRC_DIR/core/src/pin.rs:LL:COL
57+
+ (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]) = move _3; // scope 5 at $SRC_DIR/core/src/pin.rs:LL:COL
6658
StorageDead(_3); // scope 0 at $DIR/inline_generator.rs:+1:31: +1:32
6759
- _1 = <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume(move _2, const false) -> [return: bb3, unwind: bb4]; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
6860
- // mir::Constant
6961
- // + span: $DIR/inline_generator.rs:9:33: 9:39
7062
- // + literal: Const { ty: for<'a> fn(Pin<&'a mut [generator@$DIR/inline_generator.rs:15:5: 15:8]>, bool) -> GeneratorState<<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Yield, <[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::Return> {<[generator@$DIR/inline_generator.rs:15:5: 15:8] as Generator<bool>>::resume}, val: Value(<ZST>) }
71-
+ StorageLive(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
72-
+ _7 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
73-
+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
74-
+ _9 = discriminant((*_10)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
75-
+ switchInt(move _9) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
63+
+ StorageLive(_5); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
64+
+ _5 = const false; // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
65+
+ _8 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
66+
+ _7 = discriminant((*_8)); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
67+
+ switchInt(move _7) -> [0: bb3, 1: bb8, 3: bb7, otherwise: bb9]; // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
7668
}
7769

7870
- bb3: {
7971
+ bb1: {
80-
+ StorageDead(_7); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
72+
+ StorageDead(_5); // scope 0 at $DIR/inline_generator.rs:+1:14: +1:46
8173
StorageDead(_2); // scope 0 at $DIR/inline_generator.rs:+1:45: +1:46
8274
StorageDead(_4); // scope 0 at $DIR/inline_generator.rs:+1:46: +1:47
8375
_0 = const (); // scope 0 at $DIR/inline_generator.rs:+0:11: +2:2
@@ -91,37 +83,37 @@
9183
+ }
9284
+
9385
+ bb3: {
94-
+ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
95-
+ switchInt(move _7) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
86+
+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
87+
+ switchInt(move _5) -> [0: bb5, otherwise: bb4]; // scope 6 at $DIR/inline_generator.rs:15:20: 15:21
9688
+ }
9789
+
9890
+ bb4: {
99-
+ _8 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25
91+
+ _6 = const 7_i32; // scope 6 at $DIR/inline_generator.rs:15:24: 15:25
10092
+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
10193
+ }
10294
+
10395
+ bb5: {
104-
+ _8 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37
96+
+ _6 = const 13_i32; // scope 6 at $DIR/inline_generator.rs:15:35: 15:37
10597
+ goto -> bb6; // scope 6 at $DIR/inline_generator.rs:15:17: 15:39
10698
+ }
10799
+
108100
+ bb6: {
109101
+ Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
110-
+ ((_1 as Yielded).0: i32) = move _8; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
102+
+ ((_1 as Yielded).0: i32) = move _6; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
111103
+ discriminant(_1) = 0; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
112-
+ _11 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
113-
+ discriminant((*_11)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
104+
+ _9 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
105+
+ discriminant((*_9)) = 3; // scope 6 at $DIR/inline_generator.rs:15:11: 15:39
114106
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:11: 15:39
115107
+ }
116108
+
117109
+ bb7: {
118-
+ StorageLive(_8); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
119-
+ StorageDead(_8); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
110+
+ StorageLive(_6); // scope 6 at $DIR/inline_generator.rs:15:5: 15:41
111+
+ StorageDead(_6); // scope 6 at $DIR/inline_generator.rs:15:38: 15:39
120112
+ Deinit(_1); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
121-
+ ((_1 as Complete).0: bool) = move _7; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
113+
+ ((_1 as Complete).0: bool) = move _5; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
122114
+ discriminant(_1) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
123-
+ _12 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
124-
+ discriminant((*_12)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
115+
+ _10 = deref_copy (_2.0: &mut [generator@$DIR/inline_generator.rs:15:5: 15:8]); // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
116+
+ discriminant((*_10)) = 1; // scope 6 at $DIR/inline_generator.rs:15:41: 15:41
125117
+ goto -> bb1; // scope 0 at $DIR/inline_generator.rs:15:41: 15:41
126118
+ }
127119
+

‎src/test/mir-opt/issue_101973.inner.ConstProp.diff

+1-9
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@
2626
scope 3 (inlined core::num::<impl u32>::rotate_right) { // at $DIR/issue_101973.rs:14:5: 14:58
2727
debug self => _4; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
2828
debug n => _6; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
29-
let mut _15: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
30-
let mut _16: u32; // in scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
3129
}
3230

3331
bb0: {
@@ -54,11 +52,7 @@
5452
bb2: {
5553
_6 = move (_11.0: u32); // scope 0 at $DIR/issue_101973.rs:+1:31: +1:57
5654
StorageDead(_7); // scope 0 at $DIR/issue_101973.rs:+1:56: +1:57
57-
StorageLive(_15); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
58-
_15 = _4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
59-
StorageLive(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
60-
_16 = _6; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
61-
_3 = rotate_right::<u32>(move _15, move _16) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
55+
_3 = rotate_right::<u32>(move _4, move _6) -> bb4; // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
6256
// mir::Constant
6357
// + span: $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
6458
// + literal: Const { ty: extern "rust-intrinsic" fn(u32, u32) -> u32 {rotate_right::<u32>}, val: Value(<ZST>) }
@@ -81,8 +75,6 @@
8175
}
8276

8377
bb4: {
84-
StorageDead(_16); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
85-
StorageDead(_15); // scope 3 at $SRC_DIR/core/src/num/uint_macros.rs:LL:COL
8678
StorageDead(_6); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
8779
StorageDead(_4); // scope 0 at $DIR/issue_101973.rs:+1:57: +1:58
8880
_2 = move _3 as i32 (IntToInt); // scope 0 at $DIR/issue_101973.rs:+1:5: +1:65

‎src/test/mir-opt/issues/issue_59352.num_to_digit.PreCodegen.after.mir

+23-23
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@
33
fn num_to_digit(_1: char) -> u32 {
44
debug num => _1; // in scope 0 at $DIR/issue_59352.rs:+0:21: +0:24
55
let mut _0: u32; // return place in scope 0 at $DIR/issue_59352.rs:+0:35: +0:38
6-
let mut _2: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
7-
let mut _3: u32; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
6+
let mut _2: char; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:11
7+
let mut _3: std::option::Option<u32>; // in scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
8+
let mut _4: u32; // in scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
89
let mut _9: isize; // in scope 0 at $SRC_DIR/core/src/macros/mod.rs:LL:COL
910
scope 1 (inlined char::methods::<impl char>::is_digit) { // at $DIR/issue_59352.rs:14:8: 14:23
10-
debug self => _1; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
11-
debug radix => _3; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
12-
let mut _4: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
13-
let _5: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
14-
let mut _6: char; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
11+
debug self => _2; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
12+
debug radix => _4; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
13+
let mut _5: &std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
14+
let _6: std::option::Option<u32>; // in scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
1515
scope 2 (inlined Option::<u32>::is_some) { // at $SRC_DIR/core/src/char/methods.rs:LL:COL
16-
debug self => _4; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
16+
debug self => _5; // in scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
1717
}
1818
}
1919
scope 3 (inlined #[track_caller] Option::<u32>::unwrap) { // at $DIR/issue_59352.rs:14:26: 14:50
20-
debug self => _2; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
20+
debug self => _3; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
2121
let mut _7: isize; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
2222
let mut _8: !; // in scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
2323
scope 4 {
@@ -26,27 +26,27 @@ fn num_to_digit(_1: char) -> u32 {
2626
}
2727

2828
bb0: {
29-
StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
30-
StorageLive(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
29+
StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:11
30+
_2 = _1; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:11
31+
StorageLive(_4); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
3132
StorageLive(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
3233
StorageLive(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
33-
_6 = _1; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
34-
_5 = char::methods::<impl char>::to_digit(move _6, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
34+
_6 = char::methods::<impl char>::to_digit(move _2, const 8_u32) -> bb5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
3535
// mir::Constant
3636
// + span: $SRC_DIR/core/src/char/methods.rs:LL:COL
3737
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
3838
}
3939

4040
bb1: {
41-
StorageLive(_2); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
42-
_2 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
41+
StorageLive(_3); // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
42+
_3 = char::methods::<impl char>::to_digit(move _1, const 8_u32) -> bb2; // scope 0 at $DIR/issue_59352.rs:+2:26: +2:41
4343
// mir::Constant
4444
// + span: $DIR/issue_59352.rs:14:30: 14:38
4545
// + literal: Const { ty: fn(char, u32) -> Option<u32> {char::methods::<impl char>::to_digit}, val: Value(<ZST>) }
4646
}
4747

4848
bb2: {
49-
_7 = discriminant(_2); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
49+
_7 = discriminant(_3); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
5050
switchInt(move _7) -> [0: bb6, 1: bb8, otherwise: bb7]; // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
5151
}
5252

@@ -60,12 +60,12 @@ fn num_to_digit(_1: char) -> u32 {
6060
}
6161

6262
bb5: {
63-
_4 = &_5; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
64-
StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
65-
_9 = discriminant((*_4)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
66-
StorageDead(_4); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
63+
_5 = &_6; // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
64+
_9 = discriminant((*_5)); // scope 2 at $SRC_DIR/core/src/option.rs:LL:COL
6765
StorageDead(_5); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
68-
StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
66+
StorageDead(_6); // scope 1 at $SRC_DIR/core/src/char/methods.rs:LL:COL
67+
StorageDead(_4); // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
68+
StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:22: +2:23
6969
switchInt(move _9) -> [1: bb1, otherwise: bb3]; // scope 0 at $DIR/issue_59352.rs:+2:8: +2:23
7070
}
7171

@@ -85,8 +85,8 @@ fn num_to_digit(_1: char) -> u32 {
8585
}
8686

8787
bb8: {
88-
_0 = move ((_2 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
89-
StorageDead(_2); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50
88+
_0 = move ((_3 as Some).0: u32); // scope 3 at $SRC_DIR/core/src/option.rs:LL:COL
89+
StorageDead(_3); // scope 0 at $DIR/issue_59352.rs:+2:49: +2:50
9090
goto -> bb4; // scope 0 at $DIR/issue_59352.rs:+2:5: +2:63
9191
}
9292
}

‎src/test/mir-opt/separate_const_switch.identity.SeparateConstSwitch.diff

+29-37
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
scope 2 {
1818
scope 8 (inlined #[track_caller] <Result<i32, i32> as FromResidual<Result<Infallible, i32>>>::from_residual) { // at $DIR/separate_const_switch.rs:25:8: 25:10
1919
debug residual => _8; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
20-
let _16: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
21-
let mut _17: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
22-
let mut _18: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
20+
let mut _14: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
21+
let mut _15: i32; // in scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
2322
scope 9 {
24-
debug e => _16; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
23+
debug e => _15; // in scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
2524
}
2625
}
2726
}
@@ -34,11 +33,9 @@
3433
scope 5 (inlined <Result<i32, i32> as Try>::branch) { // at $DIR/separate_const_switch.rs:25:8: 25:10
3534
debug self => _4; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
3635
let mut _10: isize; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
37-
let _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
38-
let mut _12: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
39-
let _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
40-
let mut _14: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
41-
let mut _15: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
36+
let mut _11: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
37+
let mut _12: std::result::Result<std::convert::Infallible, i32>; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
38+
let mut _13: i32; // in scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
4239
scope 6 {
4340
debug v => _11; // in scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
4441
}
@@ -52,12 +49,16 @@
5249
StorageLive(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
5350
StorageLive(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
5451
_4 = _1; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:9
52+
StorageLive(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
53+
StorageLive(_13); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
5554
_10 = discriminant(_4); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
5655
- switchInt(move _10) -> [0: bb7, 1: bb5, otherwise: bb6]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
5756
+ switchInt(move _10) -> [0: bb6, 1: bb4, otherwise: bb5]; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
5857
}
5958

6059
bb1: {
60+
- StorageDead(_13); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
61+
- StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
6162
- StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
6263
- _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
6364
- switchInt(move _5) -> [0: bb2, 1: bb4, otherwise: bb3]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
@@ -87,35 +88,30 @@
8788
_6 = ((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
8889
StorageLive(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
8990
_8 = _6; // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
90-
StorageLive(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
91-
_16 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
92-
StorageLive(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
93-
StorageLive(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
94-
_18 = move _16; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
95-
- _17 = <i32 as From<i32>>::from(move _18) -> bb8; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
96-
+ _17 = <i32 as From<i32>>::from(move _18) -> bb7; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
91+
StorageLive(_15); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
92+
_15 = move ((_8 as Err).0: i32); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
93+
StorageLive(_14); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
94+
- _14 = <i32 as From<i32>>::from(move _15) -> bb8; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
95+
+ _14 = <i32 as From<i32>>::from(move _15) -> bb7; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
9796
// mir::Constant
9897
// + span: $SRC_DIR/core/src/result.rs:LL:COL
9998
// + literal: Const { ty: fn(i32) -> i32 {<i32 as From<i32>>::from}, val: Value(<ZST>) }
10099
}
101100

102101
- bb5: {
103102
+ bb4: {
104-
StorageLive(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
105103
_13 = move ((_4 as Err).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
106-
StorageLive(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
107-
StorageLive(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
108-
_15 = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
109-
Deinit(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
110-
((_14 as Err).0: i32) = move _15; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
111-
discriminant(_14) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
112-
StorageDead(_15); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
104+
StorageLive(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
105+
Deinit(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
106+
((_12 as Err).0: i32) = move _13; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
107+
discriminant(_12) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
113108
Deinit(_3); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
114-
((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _14; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
109+
((_3 as Break).0: std::result::Result<std::convert::Infallible, i32>) = move _12; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
115110
discriminant(_3) = 1; // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
116-
StorageDead(_14); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
117-
StorageDead(_13); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
111+
StorageDead(_12); // scope 7 at $SRC_DIR/core/src/result.rs:LL:COL
118112
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
113+
+ StorageDead(_13); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
114+
+ StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
119115
+ StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
120116
+ _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
121117
+ switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
@@ -128,29 +124,25 @@
128124

129125
- bb7: {
130126
+ bb6: {
131-
StorageLive(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
132127
_11 = move ((_4 as Ok).0: i32); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
133-
StorageLive(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
134-
_12 = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
135128
Deinit(_3); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
136-
((_3 as Continue).0: i32) = move _12; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
129+
((_3 as Continue).0: i32) = move _11; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
137130
discriminant(_3) = 0; // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
138-
StorageDead(_12); // scope 6 at $SRC_DIR/core/src/result.rs:LL:COL
139-
StorageDead(_11); // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
140131
- goto -> bb1; // scope 5 at $SRC_DIR/core/src/result.rs:LL:COL
132+
+ StorageDead(_13); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
133+
+ StorageDead(_11); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
141134
+ StorageDead(_4); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
142135
+ _5 = discriminant(_3); // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
143136
+ switchInt(move _5) -> [0: bb1, 1: bb3, otherwise: bb2]; // scope 0 at $DIR/separate_const_switch.rs:+1:8: +1:10
144137
}
145138

146139
- bb8: {
147140
+ bb7: {
148-
StorageDead(_18); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
149141
Deinit(_0); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
150-
((_0 as Err).0: i32) = move _17; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
142+
((_0 as Err).0: i32) = move _14; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
151143
discriminant(_0) = 1; // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
152-
StorageDead(_17); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
153-
StorageDead(_16); // scope 8 at $SRC_DIR/core/src/result.rs:LL:COL
144+
StorageDead(_14); // scope 9 at $SRC_DIR/core/src/result.rs:LL:COL
145+
StorageDead(_15); // scope 2 at $DIR/separate_const_switch.rs:+1:8: +1:10
154146
StorageDead(_8); // scope 2 at $DIR/separate_const_switch.rs:+1:9: +1:10
155147
StorageDead(_6); // scope 0 at $DIR/separate_const_switch.rs:+1:9: +1:10
156148
StorageDead(_2); // scope 0 at $DIR/separate_const_switch.rs:+1:10: +1:11

0 commit comments

Comments
 (0)
Please sign in to comment.