Skip to content

Commit fc56734

Browse files
committed
Update expected MIR in tests
Updated via `./x.py test mir-opt --bless --stage 1`.
1 parent bbfcff3 commit fc56734

20 files changed

+929
-676
lines changed

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff

Lines changed: 36 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,28 @@
1616
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1717
let mut _5: std::ptr::NonNull<[bool; 0]>;
1818
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
19-
let mut _6: std::num::NonZero<usize>;
19+
let mut _6: std::ptr::NonNull<[bool; 0]>;
20+
let mut _7: std::num::NonZero<usize>;
2021
scope 6 {
21-
scope 8 (inlined std::ptr::Alignment::as_nonzero) {
22-
}
23-
scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) {
24-
let _7: *const [bool; 0];
25-
scope 10 {
26-
}
27-
scope 11 (inlined NonZero::<usize>::get) {
22+
scope 7 {
23+
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
2824
}
29-
scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) {
30-
scope 13 (inlined without_provenance_mut::<[bool; 0]>) {
25+
scope 11 (inlined NonNull::<[bool; 0]>::without_provenance) {
26+
let _8: *const [bool; 0];
27+
scope 12 {
28+
}
29+
scope 13 (inlined NonZero::<usize>::get) {
30+
}
31+
scope 14 (inlined std::ptr::without_provenance::<[bool; 0]>) {
32+
scope 15 (inlined without_provenance_mut::<[bool; 0]>) {
33+
}
3134
}
3235
}
3336
}
37+
scope 9 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
38+
}
3439
}
35-
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
40+
scope 8 (inlined core::contracts::build_check_ensures::<NonNull<[bool; 0]>, {closure@NonNull<[bool; 0]>::dangling::{closure#0}}>) {
3641
}
3742
}
3843
}
@@ -45,22 +50,14 @@
4550
StorageLive(_4);
4651
StorageLive(_5);
4752
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
4953
StorageLive(_7);
50-
_7 = const {0x1 as *const [bool; 0]};
51-
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
54+
_7 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
55+
StorageLive(_8);
56+
_8 = const {0x1 as *const [bool; 0]};
57+
_6 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
58+
StorageDead(_8);
5259
StorageDead(_7);
53-
StorageDead(_6);
54-
_4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
55-
StorageDead(_5);
56-
_3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
57-
StorageDead(_4);
58-
_2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
59-
StorageDead(_3);
60-
_1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
61-
StorageDead(_2);
62-
_0 = const ();
63-
drop(_1) -> [return: bb1, unwind: bb2];
60+
_5 = contract_check_ensures::<{closure@NonNull<[bool; 0]>::dangling::{closure#0}}, NonNull<[bool; 0]>>(const ZeroSized: {closure@NonNull<[bool; 0]>::dangling::{closure#0}}, const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}) -> [return: bb3, unwind continue];
6461
}
6562

6663
bb1: {
@@ -71,11 +68,19 @@
7168
bb2 (cleanup): {
7269
resume;
7370
}
74-
}
75-
76-
ALLOC2 (size: 16, align: 8) { .. }
77-
78-
ALLOC1 (size: 16, align: 8) { .. }
7971

80-
ALLOC0 (size: 16, align: 8) { .. }
72+
bb3: {
73+
StorageDead(_6);
74+
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
75+
StorageDead(_5);
76+
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
77+
StorageDead(_4);
78+
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
79+
StorageDead(_3);
80+
_1 = A { foo: move _2 };
81+
StorageDead(_2);
82+
_0 = const ();
83+
drop(_1) -> [return: bb1, unwind: bb2];
84+
}
85+
}
8186

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,28 @@
1616
scope 4 (inlined Unique::<[bool; 0]>::dangling) {
1717
let mut _5: std::ptr::NonNull<[bool; 0]>;
1818
scope 5 (inlined NonNull::<[bool; 0]>::dangling) {
19-
let mut _6: std::num::NonZero<usize>;
19+
let mut _6: std::ptr::NonNull<[bool; 0]>;
20+
let mut _7: std::num::NonZero<usize>;
2021
scope 6 {
21-
scope 8 (inlined std::ptr::Alignment::as_nonzero) {
22-
}
23-
scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) {
24-
let _7: *const [bool; 0];
25-
scope 10 {
26-
}
27-
scope 11 (inlined NonZero::<usize>::get) {
22+
scope 7 {
23+
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
2824
}
29-
scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) {
30-
scope 13 (inlined without_provenance_mut::<[bool; 0]>) {
25+
scope 11 (inlined NonNull::<[bool; 0]>::without_provenance) {
26+
let _8: *const [bool; 0];
27+
scope 12 {
28+
}
29+
scope 13 (inlined NonZero::<usize>::get) {
30+
}
31+
scope 14 (inlined std::ptr::without_provenance::<[bool; 0]>) {
32+
scope 15 (inlined without_provenance_mut::<[bool; 0]>) {
33+
}
3134
}
3235
}
3336
}
37+
scope 9 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
38+
}
3439
}
35-
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
40+
scope 8 (inlined core::contracts::build_check_ensures::<NonNull<[bool; 0]>, {closure@NonNull<[bool; 0]>::dangling::{closure#0}}>) {
3641
}
3742
}
3843
}
@@ -45,29 +50,18 @@
4550
StorageLive(_4);
4651
StorageLive(_5);
4752
StorageLive(_6);
48-
- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
49-
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
5053
StorageLive(_7);
51-
- _7 = copy _6 as *const [bool; 0] (Transmute);
52-
- _5 = NonNull::<[bool; 0]> { pointer: copy _7 };
53-
+ _7 = const {0x1 as *const [bool; 0]};
54-
+ _5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
54+
- _7 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
55+
+ _7 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
56+
StorageLive(_8);
57+
- _8 = copy _7 as *const [bool; 0] (Transmute);
58+
- _6 = NonNull::<[bool; 0]> { pointer: copy _8 };
59+
+ _8 = const {0x1 as *const [bool; 0]};
60+
+ _6 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
61+
StorageDead(_8);
5562
StorageDead(_7);
56-
StorageDead(_6);
57-
- _4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
58-
+ _4 = const Unique::<[bool; 0]> {{ pointer: NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}, _marker: PhantomData::<[bool; 0]> }};
59-
StorageDead(_5);
60-
- _3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
61-
+ _3 = const Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC0, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }};
62-
StorageDead(_4);
63-
- _2 = Box::<[bool]>(copy _3, const std::alloc::Global);
64-
+ _2 = const Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC1, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global);
65-
StorageDead(_3);
66-
- _1 = A { foo: move _2 };
67-
+ _1 = const A {{ foo: Box::<[bool]>(Unique::<[bool]> {{ pointer: NonNull::<[bool]> {{ pointer: Indirect { alloc_id: ALLOC2, offset: Size(0 bytes) }: *const [bool] }}, _marker: PhantomData::<[bool]> }}, std::alloc::Global) }};
68-
StorageDead(_2);
69-
_0 = const ();
70-
drop(_1) -> [return: bb1, unwind: bb2];
63+
- _5 = contract_check_ensures::<{closure@NonNull<[bool; 0]>::dangling::{closure#0}}, NonNull<[bool; 0]>>(const ZeroSized: {closure@NonNull<[bool; 0]>::dangling::{closure#0}}, move _6) -> [return: bb3, unwind continue];
64+
+ _5 = contract_check_ensures::<{closure@NonNull<[bool; 0]>::dangling::{closure#0}}, NonNull<[bool; 0]>>(const ZeroSized: {closure@NonNull<[bool; 0]>::dangling::{closure#0}}, const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }}) -> [return: bb3, unwind continue];
7165
}
7266

7367
bb1: {
@@ -78,11 +72,19 @@
7872
bb2 (cleanup): {
7973
resume;
8074
}
75+
76+
bb3: {
77+
StorageDead(_6);
78+
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
79+
StorageDead(_5);
80+
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
81+
StorageDead(_4);
82+
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
83+
StorageDead(_3);
84+
_1 = A { foo: move _2 };
85+
StorageDead(_2);
86+
_0 = const ();
87+
drop(_1) -> [return: bb1, unwind: bb2];
88+
}
8189
}
82-
+
83-
+ ALLOC2 (size: 16, align: 8) { .. }
84-
+
85-
+ ALLOC1 (size: 16, align: 8) { .. }
86-
+
87-
+ ALLOC0 (size: 16, align: 8) { .. }
8890

tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff

Lines changed: 52 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,81 @@
66
let _1: bool;
77
let mut _2: *mut u8;
88
scope 1 (inlined dangling_mut::<u8>) {
9+
let mut _3: std::ptr::NonNull<u8>;
910
scope 2 (inlined NonNull::<u8>::dangling) {
10-
let mut _3: std::num::NonZero<usize>;
11+
let mut _4: std::ptr::NonNull<u8>;
12+
let mut _5: std::num::NonZero<usize>;
1113
scope 3 {
12-
scope 5 (inlined std::ptr::Alignment::as_nonzero) {
13-
}
14-
scope 6 (inlined NonNull::<u8>::without_provenance) {
15-
scope 7 {
16-
}
17-
scope 8 (inlined NonZero::<usize>::get) {
14+
scope 4 {
15+
scope 7 (inlined std::ptr::Alignment::as_nonzero) {
1816
}
19-
scope 9 (inlined std::ptr::without_provenance::<u8>) {
20-
scope 10 (inlined without_provenance_mut::<u8>) {
17+
scope 8 (inlined NonNull::<u8>::without_provenance) {
18+
let _6: *const u8;
19+
scope 9 {
20+
}
21+
scope 10 (inlined NonZero::<usize>::get) {
22+
}
23+
scope 11 (inlined std::ptr::without_provenance::<u8>) {
24+
scope 12 (inlined without_provenance_mut::<u8>) {
25+
}
2126
}
2227
}
2328
}
29+
scope 6 (inlined std::ptr::Alignment::of::<u8>) {
30+
}
2431
}
25-
scope 4 (inlined std::ptr::Alignment::of::<u8>) {
32+
scope 5 (inlined core::contracts::build_check_ensures::<NonNull<u8>, {closure@NonNull<u8>::dangling::{closure#0}}>) {
2633
}
2734
}
28-
scope 11 (inlined NonNull::<u8>::as_ptr) {
35+
scope 13 (inlined NonNull::<u8>::as_ptr) {
2936
}
3037
}
31-
scope 12 (inlined Foo::<u8>::cmp_ptr) {
32-
let mut _4: *const u8;
33-
let mut _5: *mut u8;
34-
let mut _6: *const u8;
35-
scope 13 (inlined std::ptr::eq::<u8>) {
38+
scope 14 (inlined Foo::<u8>::cmp_ptr) {
39+
let mut _7: *const u8;
40+
let mut _8: *mut u8;
41+
let mut _9: *const u8;
42+
scope 15 (inlined std::ptr::eq::<u8>) {
3643
}
3744
}
3845

3946
bb0: {
4047
StorageLive(_1);
4148
StorageLive(_2);
42-
StorageLive(_3);
43-
- _3 = const std::ptr::Alignment::of::<u8>::{constant#0} as std::num::NonZero<usize> (Transmute);
44-
- _2 = copy _3 as *mut u8 (Transmute);
45-
+ _3 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
46-
+ _2 = const {0x1 as *mut u8};
47-
StorageDead(_3);
49+
- StorageLive(_3);
50+
+ nop;
4851
StorageLive(_4);
4952
StorageLive(_5);
50-
- _5 = copy _2;
51-
- _4 = copy _2 as *const u8 (PtrToPtr);
52-
+ _5 = const {0x1 as *mut u8};
53-
+ _4 = const {0x1 as *const u8};
54-
StorageDead(_5);
53+
- _5 = const std::ptr::Alignment::of::<u8>::{constant#0} as std::num::NonZero<usize> (Transmute);
54+
+ _5 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
5555
StorageLive(_6);
56-
- _6 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr);
57-
- _1 = Eq(copy _4, copy _6);
56+
- _6 = copy _5 as *const u8 (Transmute);
57+
- _4 = NonNull::<u8> { pointer: copy _6 };
5858
+ _6 = const {0x1 as *const u8};
59-
+ _1 = const true;
59+
+ _4 = const NonNull::<u8> {{ pointer: {0x1 as *const u8} }};
6060
StorageDead(_6);
61+
StorageDead(_5);
62+
- _3 = contract_check_ensures::<{closure@NonNull<u8>::dangling::{closure#0}}, NonNull<u8>>(const ZeroSized: {closure@NonNull<u8>::dangling::{closure#0}}, move _4) -> [return: bb1, unwind continue];
63+
+ _3 = contract_check_ensures::<{closure@NonNull<u8>::dangling::{closure#0}}, NonNull<u8>>(const ZeroSized: {closure@NonNull<u8>::dangling::{closure#0}}, const NonNull::<u8> {{ pointer: {0x1 as *const u8} }}) -> [return: bb1, unwind continue];
64+
}
65+
66+
bb1: {
6167
StorageDead(_4);
68+
_2 = copy _3 as *mut u8 (Transmute);
69+
- StorageDead(_3);
70+
+ nop;
71+
StorageLive(_7);
72+
StorageLive(_8);
73+
_8 = copy _2;
74+
- _7 = copy _2 as *const u8 (PtrToPtr);
75+
+ _7 = copy _3 as *const u8 (Transmute);
76+
StorageDead(_8);
77+
StorageLive(_9);
78+
- _9 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr);
79+
- _1 = Eq(copy _7, copy _9);
80+
+ _9 = const {0x1 as *const u8};
81+
+ _1 = Eq(copy _7, const {0x1 as *const u8});
82+
StorageDead(_9);
83+
StorageDead(_7);
6284
StorageDead(_2);
6385
StorageDead(_1);
6486
_0 = const ();

tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.Inline.panic-unwind.diff

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@
99
let mut _4: u32;
1010
+ scope 1 (inlined #[track_caller] core::num::<impl u16>::unchecked_shl) {
1111
+ let _5: ();
12+
+ let mut _6: {closure@core::num::<impl u16>::unchecked_shl::{closure#0}};
13+
+ let mut _7: &u32;
14+
+ let _8: ();
1215
+ scope 2 (inlined core::ub_checks::check_language_ub) {
13-
+ let mut _6: bool;
16+
+ let mut _9: bool;
1417
+ scope 3 (inlined core::ub_checks::check_language_ub::runtime) {
1518
+ }
1619
+ }
@@ -23,18 +26,30 @@
2326
_4 = copy _2;
2427
- _0 = core::num::<impl u16>::unchecked_shl(move _3, move _4) -> [return: bb1, unwind continue];
2528
+ StorageLive(_5);
29+
+ StorageLive(_8);
30+
+ StorageLive(_9);
2631
+ StorageLive(_6);
27-
+ _6 = UbChecks();
28-
+ switchInt(copy _6) -> [0: bb2, otherwise: bb1];
32+
+ StorageLive(_7);
33+
+ _7 = &_4;
34+
+ _6 = {closure@$SRC_DIR/core/src/num/uint_macros.rs:LL:COL} { 0: copy _7 };
35+
+ StorageDead(_7);
36+
+ _5 = contract_check_requires::<{closure@core::num::<impl u16>::unchecked_shl::{closure#0}}>(move _6) -> [return: bb1, unwind continue];
2937
}
3038

3139
bb1: {
32-
+ _5 = core::num::<impl u16>::unchecked_shl::precondition_check(copy _4) -> [return: bb2, unwind unreachable];
40+
+ StorageDead(_6);
41+
+ _9 = UbChecks();
42+
+ switchInt(copy _9) -> [0: bb3, otherwise: bb2];
3343
+ }
3444
+
3545
+ bb2: {
46+
+ _8 = core::num::<impl u16>::unchecked_shl::precondition_check(copy _4) -> [return: bb3, unwind unreachable];
47+
+ }
48+
+
49+
+ bb3: {
3650
+ _0 = ShlUnchecked(copy _3, copy _4);
37-
+ StorageDead(_6);
51+
+ StorageDead(_9);
52+
+ StorageDead(_8);
3853
+ StorageDead(_5);
3954
StorageDead(_4);
4055
StorageDead(_3);

tests/mir-opt/inline/unchecked_shifts.unchecked_shl_unsigned_smaller.PreCodegen.after.panic-unwind.mir

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,32 @@ fn unchecked_shl_unsigned_smaller(_1: u16, _2: u32) -> u16 {
44
debug a => _1;
55
debug b => _2;
66
let mut _0: u16;
7+
let mut _3: u32;
78
scope 1 (inlined #[track_caller] core::num::<impl u16>::unchecked_shl) {
9+
let mut _4: &u32;
10+
let mut _5: {closure@core::num::<impl u16>::unchecked_shl::{closure#0}};
11+
let _6: ();
812
scope 2 (inlined core::ub_checks::check_language_ub) {
913
scope 3 (inlined core::ub_checks::check_language_ub::runtime) {
1014
}
1115
}
1216
}
1317

1418
bb0: {
19+
StorageLive(_3);
20+
_3 = copy _2;
21+
StorageLive(_5);
22+
StorageLive(_4);
23+
_4 = &_3;
24+
_5 = {closure@$SRC_DIR/core/src/num/uint_macros.rs:LL:COL} { 0: copy _4 };
25+
StorageDead(_4);
26+
_6 = contract_check_requires::<{closure@core::num::<impl u16>::unchecked_shl::{closure#0}}>(move _5) -> [return: bb1, unwind continue];
27+
}
28+
29+
bb1: {
30+
StorageDead(_5);
1531
_0 = ShlUnchecked(copy _1, copy _2);
32+
StorageDead(_3);
1633
return;
1734
}
1835
}

0 commit comments

Comments
 (0)