Skip to content

Commit 12a2edd

Browse files
committed
Always propagate into operands.
1 parent 1554942 commit 12a2edd

File tree

50 files changed

+114
-140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+114
-140
lines changed

compiler/rustc_mir_transform/src/const_prop.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -810,12 +810,7 @@ impl<'tcx> MutVisitor<'tcx> for ConstPropagator<'_, 'tcx> {
810810

811811
fn visit_operand(&mut self, operand: &mut Operand<'tcx>, location: Location) {
812812
self.super_operand(operand, location);
813-
814-
// Only const prop copies and moves on `mir_opt_level=3` as doing so
815-
// currently slightly increases compile time in some cases.
816-
if self.tcx.sess.mir_opt_level() >= 3 {
817-
self.propagate_operand(operand)
818-
}
813+
self.propagate_operand(operand)
819814
}
820815

821816
fn process_projection_elem(

tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-abort.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
StorageLive(_4);
2727
StorageLive(_5);
2828
- _5 = _1;
29+
- _4 = foo(move _5) -> [return: bb1, unwind unreachable];
2930
+ _5 = const 1_u8;
30-
_4 = foo(move _5) -> [return: bb1, unwind unreachable];
31+
+ _4 = foo(const 1_u8) -> [return: bb1, unwind unreachable];
3132
}
3233

3334
bb1: {

tests/mir-opt/const_prop/aggregate.main.ConstProp.panic-unwind.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
StorageLive(_4);
2727
StorageLive(_5);
2828
- _5 = _1;
29+
- _4 = foo(move _5) -> [return: bb1, unwind continue];
2930
+ _5 = const 1_u8;
30-
_4 = foo(move _5) -> [return: bb1, unwind continue];
31+
+ _4 = foo(const 1_u8) -> [return: bb1, unwind continue];
3132
}
3233

3334
bb1: {

tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> () {
2323
StorageLive(_4);
2424
StorageLive(_5);
2525
_5 = const 1_u8;
26-
_4 = foo(move _5) -> [return: bb1, unwind unreachable];
26+
_4 = foo(const 1_u8) -> [return: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/aggregate.main.PreCodegen.after.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ fn main() -> () {
2323
StorageLive(_4);
2424
StorageLive(_5);
2525
_5 = const 1_u8;
26-
_4 = foo(move _5) -> [return: bb1, unwind continue];
26+
_4 = foo(const 1_u8) -> [return: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
2424
+ _4 = const 4_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/array_index.main.ConstProp.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
2424
+ _4 = const 4_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
2424
+ _4 = const 4_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/array_index.main.ConstProp.64bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
2424
+ _4 = const 4_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 4_usize, const 2_usize) -> [success: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-abort.diff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
+ _5 = const false;
3939
+ _6 = const false;
4040
+ _7 = const false;
41-
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
41+
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable];
4242
}
4343

4444
bb2: {
45-
_2 = Div(const 1_i32, move _3);
45+
- _2 = Div(const 1_i32, move _3);
46+
+ _2 = Div(const 1_i32, const 0_i32);
4647
StorageDead(_3);
4748
_0 = const ();
4849
StorageDead(_2);

tests/mir-opt/const_prop/bad_op_div_by_zero.main.ConstProp.panic-unwind.diff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
+ _5 = const false;
3939
+ _6 = const false;
4040
+ _7 = const false;
41-
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
41+
+ assert(!const false, "attempt to compute `{} / {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue];
4242
}
4343

4444
bb2: {
45-
_2 = Div(const 1_i32, move _3);
45+
- _2 = Div(const 1_i32, move _3);
46+
+ _2 = Div(const 1_i32, const 0_i32);
4647
StorageDead(_3);
4748
_0 = const ();
4849
StorageDead(_2);

tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-abort.diff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
+ _5 = const false;
3939
+ _6 = const false;
4040
+ _7 = const false;
41-
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind unreachable];
41+
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind unreachable];
4242
}
4343

4444
bb2: {
45-
_2 = Rem(const 1_i32, move _3);
45+
- _2 = Rem(const 1_i32, move _3);
46+
+ _2 = Rem(const 1_i32, const 0_i32);
4647
StorageDead(_3);
4748
_0 = const ();
4849
StorageDead(_2);

tests/mir-opt/const_prop/bad_op_mod_by_zero.main.ConstProp.panic-unwind.diff

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@
3838
+ _5 = const false;
3939
+ _6 = const false;
4040
+ _7 = const false;
41-
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, _3) -> [success: bb2, unwind continue];
41+
+ assert(!const false, "attempt to compute the remainder of `{} % {}`, which would overflow", const 1_i32, const 0_i32) -> [success: bb2, unwind continue];
4242
}
4343

4444
bb2: {
45-
_2 = Rem(const 1_i32, move _3);
45+
- _2 = Rem(const 1_i32, move _3);
46+
+ _2 = Rem(const 1_i32, const 0_i32);
4647
StorageDead(_3);
4748
_0 = const ();
4849
StorageDead(_2);

tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
- _8 = Lt(_6, _7);
3939
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
4040
+ _8 = const false;
41-
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
41+
+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
4242
}
4343

4444
bb1: {

tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
- _8 = Lt(_6, _7);
3939
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
4040
+ _8 = const false;
41-
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
41+
+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
4242
}
4343

4444
bb1: {

tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
- _8 = Lt(_6, _7);
3939
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
4040
+ _8 = const false;
41-
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind unreachable];
41+
+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind unreachable];
4242
}
4343

4444
bb1: {

tests/mir-opt/const_prop/bad_op_unsafe_oob_for_slices.main.ConstProp.64bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
- _8 = Lt(_6, _7);
3939
- assert(move _8, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
4040
+ _8 = const false;
41-
+ assert(const false, "index out of bounds: the length is {} but the index is {}", move _7, _6) -> [success: bb1, unwind continue];
41+
+ assert(const false, "index out of bounds: the length is {} but the index is {}", const 3_usize, const 3_usize) -> [success: bb1, unwind continue];
4242
}
4343

4444
bb1: {

tests/mir-opt/const_prop/boxes.main.ConstProp.panic-abort.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
StorageLive(_3);
2525
- _4 = SizeOf(i32);
2626
- _5 = AlignOf(i32);
27+
- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable];
2728
+ _4 = const 4_usize;
2829
+ _5 = const 4_usize;
29-
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind unreachable];
30+
+ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind unreachable];
3031
}
3132

3233
bb1: {

tests/mir-opt/const_prop/boxes.main.ConstProp.panic-unwind.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@
2424
StorageLive(_3);
2525
- _4 = SizeOf(i32);
2626
- _5 = AlignOf(i32);
27+
- _6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue];
2728
+ _4 = const 4_usize;
2829
+ _5 = const 4_usize;
29-
_6 = alloc::alloc::exchange_malloc(move _4, move _5) -> [return: bb1, unwind continue];
30+
+ _6 = alloc::alloc::exchange_malloc(const 4_usize, const 4_usize) -> [return: bb1, unwind continue];
3031
}
3132

3233
bb1: {

tests/mir-opt/const_prop/indirect.main.ConstProp.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable];
1919
+ _2 = const 2_u8;
2020
+ _3 = const (3_u8, false);
21-
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind unreachable];
21+
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind unreachable];
2222
}
2323

2424
bb1: {

tests/mir-opt/const_prop/indirect.main.ConstProp.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
- assert(!move (_3.1: bool), "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue];
1919
+ _2 = const 2_u8;
2020
+ _3 = const (3_u8, false);
21-
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", move _2, const 1_u8) -> [success: bb1, unwind continue];
21+
+ assert(!const false, "attempt to compute `{} + {}`, which would overflow", const 2_u8, const 1_u8) -> [success: bb1, unwind continue];
2222
}
2323

2424
bb1: {

tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- _4 = CheckedAdd(_2, _3);
2424
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
2525
+ _4 = const (0_u8, true);
26-
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind unreachable];
26+
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/inherit_overflow.main.ConstProp.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- _4 = CheckedAdd(_2, _3);
2424
- assert(!move (_4.1: bool), "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
2525
+ _4 = const (0_u8, true);
26-
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", _2, _3) -> [success: bb1, unwind continue];
26+
+ assert(!const true, "attempt to compute `{} + {}`, which would overflow", const u8::MAX, const 1_u8) -> [success: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/invalid_constant.main.ConstProp.diff

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
StorageLive(_5);
4444
_5 = InvalidTag { int: const 4_u32 };
4545
- _4 = (_5.1: E);
46+
- _3 = [move _4];
4647
+ _4 = const Scalar(0x00000004): E;
47-
_3 = [move _4];
48+
+ _3 = [const Scalar(0x00000004): E];
4849
StorageDead(_4);
4950
StorageDead(_5);
5051
nop;

tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
2424
+ _4 = const 5000_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/large_array_index.main.ConstProp.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
2424
+ _4 = const 5000_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
2424
+ _4 = const 5000_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind unreachable];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind unreachable];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/large_array_index.main.ConstProp.64bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
- assert(move _5, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
2424
+ _4 = const 5000_usize;
2525
+ _5 = const true;
26-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _4, _3) -> [success: bb1, unwind continue];
26+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 5000_usize, const 2_usize) -> [success: bb1, unwind continue];
2727
}
2828

2929
bb1: {

tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-abort.diff

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,39 @@
2828
StorageLive(_1);
2929
StorageLive(_2);
3030
- _2 = OffsetOf(Alpha, [0]);
31+
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
3132
+ _2 = const 4_usize;
32-
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
33+
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
3334
}
3435

3536
bb1: {
3637
StorageDead(_2);
3738
StorageLive(_3);
3839
StorageLive(_4);
3940
- _4 = OffsetOf(Alpha, [1]);
41+
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
4042
+ _4 = const 0_usize;
41-
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
43+
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
4244
}
4345

4446
bb2: {
4547
StorageDead(_4);
4648
StorageLive(_5);
4749
StorageLive(_6);
4850
- _6 = OffsetOf(Alpha, [2, 0]);
51+
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
4952
+ _6 = const 2_usize;
50-
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
53+
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
5154
}
5255

5356
bb3: {
5457
StorageDead(_6);
5558
StorageLive(_7);
5659
StorageLive(_8);
5760
- _8 = OffsetOf(Alpha, [2, 1]);
61+
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
5862
+ _8 = const 3_usize;
59-
_7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
63+
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
6064
}
6165

6266
bb4: {

tests/mir-opt/const_prop/offset_of.concrete.ConstProp.panic-unwind.diff

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,35 +28,39 @@
2828
StorageLive(_1);
2929
StorageLive(_2);
3030
- _2 = OffsetOf(Alpha, [0]);
31+
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
3132
+ _2 = const 4_usize;
32-
_1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
33+
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
3334
}
3435

3536
bb1: {
3637
StorageDead(_2);
3738
StorageLive(_3);
3839
StorageLive(_4);
3940
- _4 = OffsetOf(Alpha, [1]);
41+
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
4042
+ _4 = const 0_usize;
41-
_3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
43+
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
4244
}
4345

4446
bb2: {
4547
StorageDead(_4);
4648
StorageLive(_5);
4749
StorageLive(_6);
4850
- _6 = OffsetOf(Alpha, [2, 0]);
51+
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
4952
+ _6 = const 2_usize;
50-
_5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
53+
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
5154
}
5255

5356
bb3: {
5457
StorageDead(_6);
5558
StorageLive(_7);
5659
StorageLive(_8);
5760
- _8 = OffsetOf(Alpha, [2, 1]);
61+
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
5862
+ _8 = const 3_usize;
59-
_7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
63+
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
6064
}
6165

6266
bb4: {

tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
2626
+ _5 = const 8_usize;
2727
+ _6 = const true;
28-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind unreachable];
28+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind unreachable];
2929
}
3030

3131
bb1: {

tests/mir-opt/const_prop/repeat.main.ConstProp.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
- assert(move _6, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
2626
+ _5 = const 8_usize;
2727
+ _6 = const true;
28-
+ assert(const true, "index out of bounds: the length is {} but the index is {}", move _5, _4) -> [success: bb1, unwind continue];
28+
+ assert(const true, "index out of bounds: the length is {} but the index is {}", const 8_usize, const 2_usize) -> [success: bb1, unwind continue];
2929
}
3030

3131
bb1: {

0 commit comments

Comments
 (0)