Skip to content

Commit 78aad63

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

3 files changed

+162
-94
lines changed

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

+49-29
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,34 @@
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 _6: std::ptr::Alignment;
20+
let mut _7: std::num::NonZero<usize>;
2021
scope 6 {
21-
scope 8 (inlined std::ptr::Alignment::as_nonzero) {
22+
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
23+
let mut _8: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
24+
let mut _9: std::num::NonZero<usize>;
25+
scope 11 {
26+
}
27+
scope 12 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
28+
}
2229
}
23-
scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) {
24-
let _7: *const [bool; 0];
25-
scope 10 {
30+
scope 13 (inlined NonNull::<[bool; 0]>::without_provenance) {
31+
let _10: *const [bool; 0];
32+
scope 14 {
2633
}
27-
scope 11 (inlined NonZero::<usize>::get) {
34+
scope 15 (inlined NonZero::<usize>::get) {
2835
}
29-
scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) {
30-
scope 13 (inlined without_provenance_mut::<[bool; 0]>) {
36+
scope 16 (inlined std::ptr::without_provenance::<[bool; 0]>) {
37+
scope 17 (inlined without_provenance_mut::<[bool; 0]>) {
3138
}
3239
}
3340
}
3441
}
3542
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
43+
scope 8 {
44+
}
45+
scope 9 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
46+
}
3647
}
3748
}
3849
}
@@ -45,22 +56,7 @@
4556
StorageLive(_4);
4657
StorageLive(_5);
4758
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize));
49-
StorageLive(_7);
50-
_7 = const {0x1 as *const [bool; 0]};
51-
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};
52-
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];
59+
_6 = contract_check_ensures::<{closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}) -> [return: bb3, unwind continue];
6460
}
6561

6662
bb1: {
@@ -71,11 +67,35 @@
7167
bb2 (cleanup): {
7268
resume;
7369
}
74-
}
7570

76-
ALLOC2 (size: 16, align: 8) { .. }
77-
78-
ALLOC1 (size: 16, align: 8) { .. }
71+
bb3: {
72+
StorageLive(_7);
73+
StorageLive(_8);
74+
_8 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _6 };
75+
StorageLive(_9);
76+
_9 = copy _6 as std::num::NonZero<usize> (Transmute);
77+
_7 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _8, move _9) -> [return: bb4, unwind continue];
78+
}
7979

80-
ALLOC0 (size: 16, align: 8) { .. }
80+
bb4: {
81+
StorageDead(_9);
82+
StorageDead(_8);
83+
StorageLive(_10);
84+
_10 = copy _7 as *const [bool; 0] (Transmute);
85+
_5 = NonNull::<[bool; 0]> { pointer: copy _10 };
86+
StorageDead(_10);
87+
StorageDead(_7);
88+
StorageDead(_6);
89+
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
90+
StorageDead(_5);
91+
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
92+
StorageDead(_4);
93+
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
94+
StorageDead(_3);
95+
_1 = A { foo: move _2 };
96+
StorageDead(_2);
97+
_0 = const ();
98+
drop(_1) -> [return: bb1, unwind: bb2];
99+
}
100+
}
81101

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

+50-37
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,34 @@
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 _6: std::ptr::Alignment;
20+
let mut _7: std::num::NonZero<usize>;
2021
scope 6 {
21-
scope 8 (inlined std::ptr::Alignment::as_nonzero) {
22+
scope 10 (inlined std::ptr::Alignment::as_nonzero) {
23+
let mut _8: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
24+
let mut _9: std::num::NonZero<usize>;
25+
scope 11 {
26+
}
27+
scope 12 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
28+
}
2229
}
23-
scope 9 (inlined NonNull::<[bool; 0]>::without_provenance) {
24-
let _7: *const [bool; 0];
25-
scope 10 {
30+
scope 13 (inlined NonNull::<[bool; 0]>::without_provenance) {
31+
let _10: *const [bool; 0];
32+
scope 14 {
2633
}
27-
scope 11 (inlined NonZero::<usize>::get) {
34+
scope 15 (inlined NonZero::<usize>::get) {
2835
}
29-
scope 12 (inlined std::ptr::without_provenance::<[bool; 0]>) {
30-
scope 13 (inlined without_provenance_mut::<[bool; 0]>) {
36+
scope 16 (inlined std::ptr::without_provenance::<[bool; 0]>) {
37+
scope 17 (inlined without_provenance_mut::<[bool; 0]>) {
3138
}
3239
}
3340
}
3441
}
3542
scope 7 (inlined std::ptr::Alignment::of::<[bool; 0]>) {
43+
scope 8 {
44+
}
45+
scope 9 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}>) {
46+
}
3647
}
3748
}
3849
}
@@ -45,29 +56,7 @@
4556
StorageLive(_4);
4657
StorageLive(_5);
4758
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));
50-
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]} }};
55-
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];
59+
_6 = contract_check_ensures::<{closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<[bool; 0]>::{closure#0}}, const std::ptr::Alignment::of::<[bool; 0]>::{constant#0}) -> [return: bb3, unwind continue];
7160
}
7261

7362
bb1: {
@@ -78,11 +67,35 @@
7867
bb2 (cleanup): {
7968
resume;
8069
}
70+
71+
bb3: {
72+
StorageLive(_7);
73+
StorageLive(_8);
74+
_8 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _6 };
75+
StorageLive(_9);
76+
_9 = copy _6 as std::num::NonZero<usize> (Transmute);
77+
_7 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _8, move _9) -> [return: bb4, unwind continue];
78+
}
79+
80+
bb4: {
81+
StorageDead(_9);
82+
StorageDead(_8);
83+
StorageLive(_10);
84+
_10 = copy _7 as *const [bool; 0] (Transmute);
85+
_5 = NonNull::<[bool; 0]> { pointer: copy _10 };
86+
StorageDead(_10);
87+
StorageDead(_7);
88+
StorageDead(_6);
89+
_4 = Unique::<[bool; 0]> { pointer: move _5, _marker: const PhantomData::<[bool; 0]> };
90+
StorageDead(_5);
91+
_3 = move _4 as std::ptr::Unique<[bool]> (PointerCoercion(Unsize, Implicit));
92+
StorageDead(_4);
93+
_2 = Box::<[bool]>(copy _3, const std::alloc::Global);
94+
StorageDead(_3);
95+
_1 = A { foo: move _2 };
96+
StorageDead(_2);
97+
_0 = const ();
98+
drop(_1) -> [return: bb1, unwind: bb2];
99+
}
81100
}
82-
+
83-
+ ALLOC2 (size: 16, align: 8) { .. }
84-
+
85-
+ ALLOC1 (size: 16, align: 8) { .. }
86-
+
87-
+ ALLOC0 (size: 16, align: 8) { .. }
88101

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

+63-28
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,94 @@
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 _4: std::ptr::Alignment;
12+
let mut _5: std::num::NonZero<usize>;
1113
scope 3 {
12-
scope 5 (inlined std::ptr::Alignment::as_nonzero) {
14+
scope 7 (inlined std::ptr::Alignment::as_nonzero) {
15+
let mut _6: {closure@std::ptr::Alignment::as_nonzero::{closure#0}};
16+
let mut _7: std::num::NonZero<usize>;
17+
scope 8 {
18+
}
19+
scope 9 (inlined core::contracts::build_check_ensures::<NonZero<usize>, {closure@std::ptr::Alignment::as_nonzero::{closure#0}}>) {
20+
}
1321
}
14-
scope 6 (inlined NonNull::<u8>::without_provenance) {
15-
scope 7 {
22+
scope 10 (inlined NonNull::<u8>::without_provenance) {
23+
let _8: *const u8;
24+
scope 11 {
1625
}
17-
scope 8 (inlined NonZero::<usize>::get) {
26+
scope 12 (inlined NonZero::<usize>::get) {
1827
}
19-
scope 9 (inlined std::ptr::without_provenance::<u8>) {
20-
scope 10 (inlined without_provenance_mut::<u8>) {
28+
scope 13 (inlined std::ptr::without_provenance::<u8>) {
29+
scope 14 (inlined without_provenance_mut::<u8>) {
2130
}
2231
}
2332
}
2433
}
2534
scope 4 (inlined std::ptr::Alignment::of::<u8>) {
35+
scope 5 {
36+
}
37+
scope 6 (inlined core::contracts::build_check_ensures::<std::ptr::Alignment, {closure@std::ptr::Alignment::of<u8>::{closure#0}}>) {
38+
}
2639
}
2740
}
28-
scope 11 (inlined NonNull::<u8>::as_ptr) {
41+
scope 15 (inlined NonNull::<u8>::as_ptr) {
2942
}
3043
}
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>) {
44+
scope 16 (inlined Foo::<u8>::cmp_ptr) {
45+
let mut _9: *const u8;
46+
let mut _10: *mut u8;
47+
let mut _11: *const u8;
48+
scope 17 (inlined std::ptr::eq::<u8>) {
3649
}
3750
}
3851

3952
bb0: {
4053
StorageLive(_1);
4154
StorageLive(_2);
55+
- StorageLive(_5);
56+
+ nop;
4257
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);
4858
StorageLive(_4);
49-
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);
59+
_4 = contract_check_ensures::<{closure@std::ptr::Alignment::of<u8>::{closure#0}}, std::ptr::Alignment>(const ZeroSized: {closure@std::ptr::Alignment::of<u8>::{closure#0}}, const std::ptr::Alignment::of::<u8>::{constant#0}) -> [return: bb1, unwind continue];
60+
}
61+
62+
bb1: {
5563
StorageLive(_6);
56-
- _6 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr);
57-
- _1 = Eq(copy _4, copy _6);
58-
+ _6 = const {0x1 as *const u8};
59-
+ _1 = const true;
64+
_6 = {closure@$SRC_DIR/core/src/ptr/alignment.rs:LL:COL} { 0: copy _4 };
65+
StorageLive(_7);
66+
_7 = copy _4 as std::num::NonZero<usize> (Transmute);
67+
_5 = contract_check_ensures::<{closure@std::ptr::Alignment::as_nonzero::{closure#0}}, NonZero<usize>>(move _6, move _7) -> [return: bb2, unwind continue];
68+
}
69+
70+
bb2: {
71+
StorageDead(_7);
6072
StorageDead(_6);
73+
- StorageLive(_8);
74+
+ nop;
75+
_8 = copy _5 as *const u8 (Transmute);
76+
_3 = NonNull::<u8> { pointer: copy _8 };
77+
- StorageDead(_8);
78+
+ nop;
6179
StorageDead(_4);
80+
_2 = copy _5 as *mut u8 (Transmute);
81+
StorageDead(_3);
82+
- StorageDead(_5);
83+
+ nop;
84+
StorageLive(_9);
85+
StorageLive(_10);
86+
_10 = copy _2;
87+
- _9 = copy _2 as *const u8 (PtrToPtr);
88+
+ _9 = copy _8;
89+
StorageDead(_10);
90+
StorageLive(_11);
91+
- _11 = const Foo::<u8>::SENTINEL as *const u8 (PtrToPtr);
92+
- _1 = Eq(copy _9, copy _11);
93+
+ _11 = const {0x1 as *const u8};
94+
+ _1 = Eq(copy _8, const {0x1 as *const u8});
95+
StorageDead(_11);
96+
StorageDead(_9);
6297
StorageDead(_2);
6398
StorageDead(_1);
6499
_0 = const ();

0 commit comments

Comments
 (0)