Skip to content

Commit 32510c2

Browse files
committed
bless mir-opt tests
1 parent 9b6f3cd commit 32510c2

24 files changed

Lines changed: 503 additions & 459 deletions

File tree

tests/mir-opt/async_drop_mir_pin.core.future-async_drop-async_drop_in_place-{closure#0}.[Foo;1].MentionedItems.after.mir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn async_drop_in_place::{closure#0}(_1: {async fn body of async_drop_in_place<[F
44
yields ()
55
{
66
let mut _0: ();
7-
let mut _3: *mut [Foo; 1];
7+
let mut _3: &mut [Foo; 1];
88
let mut _4: *mut [Foo; 1];
99
let mut _5: *mut [Foo];
1010
let mut _6: usize;
@@ -27,7 +27,7 @@ yields ()
2727
let mut _23: *mut Foo;
2828

2929
bb0: {
30-
_3 = move (_1.0: *mut [Foo; 1]);
30+
_3 = move (_1.0: &mut [Foo; 1]);
3131
goto -> bb17;
3232
}
3333

tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-abort.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}` 0 coroutine_drop
22

3-
fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:12:5: 12:7}) -> () {
3+
fn main::{closure#0}(_1: &mut {coroutine@$DIR/coroutine_drop_cleanup.rs:12:5: 12:7}) -> () {
44
let mut _0: ();
55
let mut _2: ();
66
let _3: std::string::String;

tests/mir-opt/coroutine_drop_cleanup.main-{closure#0}.coroutine_drop.0.panic-unwind.mir

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// MIR for `main::{closure#0}` 0 coroutine_drop
22

3-
fn main::{closure#0}(_1: *mut {coroutine@$DIR/coroutine_drop_cleanup.rs:12:5: 12:7}) -> () {
3+
fn main::{closure#0}(_1: &mut {coroutine@$DIR/coroutine_drop_cleanup.rs:12:5: 12:7}) -> () {
44
let mut _0: ();
55
let mut _2: ();
66
let _3: std::string::String;

tests/mir-opt/inline/inline_shims.drop.Inline.panic-abort.diff

Lines changed: 69 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -8,46 +8,55 @@
88
let _3: ();
99
let mut _4: *mut std::vec::Vec<A>;
1010
let mut _5: *mut std::option::Option<B>;
11-
+ scope 1 (inlined drop_in_place::<Vec<A>> - shim(Some(Vec<A>))) {
11+
+ scope 1 (inlined drop_in_place::<Vec<A>>) {
1212
+ let mut _6: &mut std::vec::Vec<A>;
13-
+ let mut _7: ();
14-
+ scope 2 (inlined <Vec<A> as Drop>::drop) {
15-
+ let mut _8: *mut [A];
16-
+ let mut _9: *mut A;
17-
+ let mut _10: usize;
18-
+ scope 3 (inlined Vec::<A>::as_mut_ptr) {
19-
+ scope 4 (inlined alloc::raw_vec::RawVec::<A>::ptr) {
20-
+ scope 5 (inlined alloc::raw_vec::RawVecInner::ptr::<A>) {
21-
+ scope 6 (inlined alloc::raw_vec::RawVecInner::non_null::<A>) {
22-
+ let mut _11: std::ptr::NonNull<u8>;
23-
+ scope 7 (inlined std::ptr::Unique::<u8>::cast::<A>) {
24-
+ scope 8 (inlined NonNull::<u8>::cast::<A>) {
25-
+ scope 9 (inlined NonNull::<u8>::as_ptr) {
13+
+ scope 2 (inlined std::ptr::drop_glue::<Vec<A>> - shim(Some(Vec<A>))) {
14+
+ let mut _7: &mut std::vec::Vec<A>;
15+
+ let mut _8: ();
16+
+ scope 3 (inlined <Vec<A> as Drop>::drop) {
17+
+ let mut _9: *mut [A];
18+
+ let mut _10: *mut A;
19+
+ let mut _11: usize;
20+
+ scope 4 (inlined Vec::<A>::as_mut_ptr) {
21+
+ scope 5 (inlined alloc::raw_vec::RawVec::<A>::ptr) {
22+
+ scope 6 (inlined alloc::raw_vec::RawVecInner::ptr::<A>) {
23+
+ scope 7 (inlined alloc::raw_vec::RawVecInner::non_null::<A>) {
24+
+ let mut _12: std::ptr::NonNull<u8>;
25+
+ scope 8 (inlined std::ptr::Unique::<u8>::cast::<A>) {
26+
+ scope 9 (inlined NonNull::<u8>::cast::<A>) {
27+
+ scope 10 (inlined NonNull::<u8>::as_ptr) {
28+
+ }
2629
+ }
2730
+ }
31+
+ scope 11 (inlined std::ptr::Unique::<A>::as_non_null_ptr) {
32+
+ }
2833
+ }
29-
+ scope 10 (inlined std::ptr::Unique::<A>::as_non_null_ptr) {
34+
+ scope 12 (inlined NonNull::<A>::as_ptr) {
3035
+ }
3136
+ }
32-
+ scope 11 (inlined NonNull::<A>::as_ptr) {
33-
+ }
3437
+ }
3538
+ }
36-
+ }
37-
+ scope 12 (inlined slice_from_raw_parts_mut::<A>) {
38-
+ scope 13 (inlined std::ptr::from_raw_parts_mut::<[A], A>) {
39+
+ scope 13 (inlined slice_from_raw_parts_mut::<A>) {
40+
+ scope 14 (inlined std::ptr::from_raw_parts_mut::<[A], A>) {
41+
+ }
42+
+ }
43+
+ scope 15 (inlined drop_in_place::<[A]>) {
44+
+ let mut _13: &mut [A];
45+
+ scope 16 (inlined std::ptr::drop_glue::<[A]> - shim(Some([A]))) {
46+
+ let mut _14: usize;
47+
+ let mut _15: *mut A;
48+
+ let mut _16: bool;
49+
+ }
3950
+ }
40-
+ }
41-
+ scope 14 (inlined drop_in_place::<[A]> - shim(Some([A]))) {
42-
+ let mut _12: usize;
43-
+ let mut _13: *mut A;
44-
+ let mut _14: bool;
4551
+ }
4652
+ }
4753
+ }
48-
+ scope 15 (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
49-
+ let mut _15: isize;
50-
+ let mut _16: isize;
54+
+ scope 17 (inlined drop_in_place::<Option<B>>) {
55+
+ let mut _17: &mut std::option::Option<B>;
56+
+ scope 18 (inlined std::ptr::drop_glue::<Option<B>> - shim(Some(Option<B>))) {
57+
+ let mut _18: isize;
58+
+ let mut _19: isize;
59+
+ }
5160
+ }
5261

5362
bb0: {
@@ -56,66 +65,75 @@
5665
_4 = copy _1;
5766
- _3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind unreachable];
5867
+ StorageLive(_6);
59-
+ StorageLive(_7);
6068
+ _6 = &mut (*_4);
61-
+ StorageLive(_10);
69+
+ StorageLive(_7);
6270
+ StorageLive(_8);
71+
+ _7 = copy _6;
6372
+ StorageLive(_9);
6473
+ StorageLive(_11);
65-
+ _11 = copy (((((*_6).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
66-
+ _9 = copy _11 as *mut A (Transmute);
67-
+ StorageDead(_11);
68-
+ _10 = copy ((*_6).1: usize);
69-
+ _8 = *mut [A] from (copy _9, copy _10);
70-
+ StorageDead(_9);
74+
+ StorageLive(_10);
7175
+ StorageLive(_12);
76+
+ _12 = copy (((((*_7).0: alloc::raw_vec::RawVec<A>).0: alloc::raw_vec::RawVecInner).0: std::ptr::Unique<u8>).0: std::ptr::NonNull<u8>);
77+
+ _10 = copy _12 as *mut A (Transmute);
78+
+ StorageDead(_12);
79+
+ _11 = copy ((*_7).1: usize);
80+
+ _9 = *mut [A] from (copy _10, copy _11);
81+
+ StorageDead(_10);
7282
+ StorageLive(_13);
83+
+ _13 = &mut (*_9);
7384
+ StorageLive(_14);
74-
+ _12 = const 0_usize;
85+
+ StorageLive(_15);
86+
+ StorageLive(_16);
87+
+ _14 = const 0_usize;
7588
+ goto -> bb4;
7689
}
7790

7891
bb1: {
92+
+ StorageDead(_8);
7993
+ StorageDead(_7);
8094
+ StorageDead(_6);
8195
StorageDead(_4);
8296
StorageDead(_3);
8397
StorageLive(_5);
8498
_5 = copy _2;
8599
- _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind unreachable];
86-
+ StorageLive(_15);
87-
+ _15 = discriminant((*_5));
88-
+ switchInt(move _15) -> [0: bb5, otherwise: bb6];
100+
+ StorageLive(_17);
101+
+ _17 = &mut (*_5);
102+
+ StorageLive(_18);
103+
+ _18 = discriminant((*_17));
104+
+ switchInt(move _18) -> [0: bb5, otherwise: bb6];
89105
}
90106

91107
bb2: {
108+
+ StorageDead(_16);
109+
+ StorageDead(_15);
92110
+ StorageDead(_14);
93111
+ StorageDead(_13);
94-
+ StorageDead(_12);
95-
+ StorageDead(_8);
96-
+ StorageDead(_10);
97-
+ drop(((*_4).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable];
112+
+ StorageDead(_11);
113+
+ StorageDead(_9);
114+
+ drop(((*_6).0: alloc::raw_vec::RawVec<A>)) -> [return: bb1, unwind unreachable];
98115
+ }
99116
+
100117
+ bb3: {
101-
+ _13 = &raw mut (*_8)[_12];
102-
+ _12 = Add(move _12, const 1_usize);
103-
+ drop((*_13)) -> [return: bb4, unwind unreachable];
118+
+ _15 = &raw mut (*_13)[_14];
119+
+ _14 = Add(move _14, const 1_usize);
120+
+ drop((*_15)) -> [return: bb4, unwind unreachable];
104121
+ }
105122
+
106123
+ bb4: {
107-
+ _14 = Eq(copy _12, copy _10);
108-
+ switchInt(move _14) -> [0: bb3, otherwise: bb2];
124+
+ _16 = Eq(copy _14, copy _11);
125+
+ switchInt(move _16) -> [0: bb3, otherwise: bb2];
109126
+ }
110127
+
111128
+ bb5: {
112-
+ StorageDead(_15);
129+
+ StorageDead(_18);
130+
+ StorageDead(_17);
113131
StorageDead(_5);
114132
return;
115133
+ }
116134
+
117135
+ bb6: {
118-
+ drop((((*_5) as Some).0: B)) -> [return: bb5, unwind unreachable];
136+
+ drop((((*_17) as Some).0: B)) -> [return: bb5, unwind unreachable];
119137
}
120138
}
121139

tests/mir-opt/inline/inline_shims.drop.Inline.panic-unwind.diff

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,50 @@
88
let _3: ();
99
let mut _4: *mut std::vec::Vec<A>;
1010
let mut _5: *mut std::option::Option<B>;
11-
+ scope 1 (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>))) {
12-
+ let mut _6: isize;
13-
+ let mut _7: isize;
11+
+ scope 1 (inlined drop_in_place::<Vec<A>>) {
12+
+ let mut _6: &mut std::vec::Vec<A>;
13+
+ }
14+
+ scope 2 (inlined drop_in_place::<Option<B>>) {
15+
+ let mut _7: &mut std::option::Option<B>;
16+
+ scope 3 (inlined std::ptr::drop_glue::<Option<B>> - shim(Some(Option<B>))) {
17+
+ let mut _8: isize;
18+
+ let mut _9: isize;
19+
+ }
1420
+ }
1521

1622
bb0: {
1723
StorageLive(_3);
1824
StorageLive(_4);
1925
_4 = copy _1;
20-
_3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue];
26+
- _3 = drop_in_place::<Vec<A>>(move _4) -> [return: bb1, unwind continue];
27+
+ StorageLive(_6);
28+
+ _6 = &mut (*_4);
29+
+ _3 = std::ptr::drop_glue::<Vec<A>>(move _6) -> [return: bb1, unwind continue];
2130
}
2231

2332
bb1: {
33+
+ StorageDead(_6);
2434
StorageDead(_4);
2535
StorageDead(_3);
2636
StorageLive(_5);
2737
_5 = copy _2;
2838
- _0 = drop_in_place::<Option<B>>(move _5) -> [return: bb2, unwind continue];
29-
+ StorageLive(_6);
30-
+ _6 = discriminant((*_5));
31-
+ switchInt(move _6) -> [0: bb2, otherwise: bb3];
39+
+ StorageLive(_7);
40+
+ _7 = &mut (*_5);
41+
+ StorageLive(_8);
42+
+ _8 = discriminant((*_7));
43+
+ switchInt(move _8) -> [0: bb2, otherwise: bb3];
3244
}
3345

3446
bb2: {
35-
+ StorageDead(_6);
47+
+ StorageDead(_8);
48+
+ StorageDead(_7);
3649
StorageDead(_5);
3750
return;
3851
+ }
3952
+
4053
+ bb3: {
41-
+ drop((((*_5) as Some).0: B)) -> [return: bb2, unwind continue];
54+
+ drop((((*_7) as Some).0: B)) -> [return: bb2, unwind continue];
4255
}
4356
}
4457

tests/mir-opt/inline/inline_shims.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ pub fn clone<A, B>(f: fn(A, B)) -> fn(A, B) {
1111
// EMIT_MIR inline_shims.drop.Inline.diff
1212
pub fn drop<A, B>(a: *mut Vec<A>, b: *mut Option<B>) {
1313
// CHECK-LABEL: fn drop(
14-
// CHECK: (inlined drop_in_place::<Option<B>> - shim(Some(Option<B>)))
14+
// CHECK: (inlined drop_in_place::<Option<B>>)
15+
// CHECK: (inlined std::ptr::drop_glue::<Option<B>> - shim(Some(Option<B>)))
1516
unsafe { std::ptr::drop_in_place(a) }
1617
unsafe { std::ptr::drop_in_place(b) }
1718
}

tests/mir-opt/pre-codegen/drop_box_of_sized.drop_bytes.PreCodegen.after.panic-abort.mir

Lines changed: 42 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3,61 +3,63 @@
33
fn drop_bytes(_1: *mut Box<[u8; 1024]>) -> () {
44
debug x => _1;
55
let mut _0: ();
6-
scope 1 (inlined drop_in_place::<Box<[u8; 1024]>> - shim(Some(Box<[u8; 1024]>))) {
7-
scope 2 (inlined <Box<[u8; 1024]> as Drop>::drop) {
8-
let _2: std::ptr::NonNull<[u8; 1024]>;
9-
let _4: ();
10-
scope 3 {
6+
scope 1 (inlined drop_in_place::<Box<[u8; 1024]>>) {
7+
scope 2 (inlined std::ptr::drop_glue::<Box<[u8; 1024]>> - shim(Some(Box<[u8; 1024]>))) {
8+
scope 3 (inlined <Box<[u8; 1024]> as Drop>::drop) {
9+
let _2: std::ptr::NonNull<[u8; 1024]>;
10+
let _4: ();
1111
scope 4 {
12-
scope 17 (inlined Layout::size) {
13-
}
14-
scope 18 (inlined std::ptr::Unique::<[u8; 1024]>::cast::<u8>) {
15-
let mut _3: std::ptr::NonNull<u8>;
16-
scope 19 (inlined NonNull::<[u8; 1024]>::cast::<u8>) {
17-
scope 20 (inlined NonNull::<[u8; 1024]>::as_ptr) {
12+
scope 5 {
13+
scope 18 (inlined Layout::size) {
14+
}
15+
scope 19 (inlined std::ptr::Unique::<[u8; 1024]>::cast::<u8>) {
16+
let mut _3: std::ptr::NonNull<u8>;
17+
scope 20 (inlined NonNull::<[u8; 1024]>::cast::<u8>) {
18+
scope 21 (inlined NonNull::<[u8; 1024]>::as_ptr) {
19+
}
1820
}
1921
}
20-
}
21-
scope 21 (inlined <NonNull<u8> as From<std::ptr::Unique<u8>>>::from) {
22-
scope 22 (inlined std::ptr::Unique::<u8>::as_non_null_ptr) {
22+
scope 22 (inlined <NonNull<u8> as From<std::ptr::Unique<u8>>>::from) {
23+
scope 23 (inlined std::ptr::Unique::<u8>::as_non_null_ptr) {
24+
}
2325
}
24-
}
25-
scope 23 (inlined <std::alloc::Global as Allocator>::deallocate) {
26-
scope 24 (inlined std::alloc::Global::deallocate_impl) {
27-
scope 25 (inlined std::alloc::Global::deallocate_impl_runtime) {
28-
scope 26 (inlined Layout::size) {
29-
}
30-
scope 27 (inlined alloc::alloc::dealloc_nonnull) {
31-
scope 28 (inlined Layout::size) {
26+
scope 24 (inlined <std::alloc::Global as Allocator>::deallocate) {
27+
scope 25 (inlined std::alloc::Global::deallocate_impl) {
28+
scope 26 (inlined std::alloc::Global::deallocate_impl_runtime) {
29+
scope 27 (inlined Layout::size) {
3230
}
33-
scope 29 (inlined Layout::alignment) {
31+
scope 28 (inlined alloc::alloc::dealloc_nonnull) {
32+
scope 29 (inlined Layout::size) {
33+
}
34+
scope 30 (inlined Layout::alignment) {
35+
}
3436
}
3537
}
3638
}
3739
}
3840
}
39-
}
40-
scope 5 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) {
41-
scope 6 (inlined NonNull::<[u8; 1024]>::as_ptr) {
42-
}
43-
}
44-
scope 7 (inlined Layout::for_value_raw::<[u8; 1024]>) {
45-
scope 8 {
46-
scope 16 (inlined #[track_caller] Layout::from_size_alignment_unchecked) {
41+
scope 6 (inlined std::ptr::Unique::<[u8; 1024]>::as_ptr) {
42+
scope 7 (inlined NonNull::<[u8; 1024]>::as_ptr) {
4743
}
4844
}
49-
scope 9 (inlined size_of_val_raw::<[u8; 1024]>) {
50-
}
51-
scope 10 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) {
52-
scope 11 {
53-
scope 13 (inlined #[track_caller] std::mem::Alignment::new_unchecked) {
54-
scope 14 (inlined core::ub_checks::check_language_ub) {
55-
scope 15 (inlined core::ub_checks::check_language_ub::runtime) {
45+
scope 8 (inlined Layout::for_value_raw::<[u8; 1024]>) {
46+
scope 9 {
47+
scope 17 (inlined #[track_caller] Layout::from_size_alignment_unchecked) {
48+
}
49+
}
50+
scope 10 (inlined size_of_val_raw::<[u8; 1024]>) {
51+
}
52+
scope 11 (inlined std::mem::Alignment::of_val_raw::<[u8; 1024]>) {
53+
scope 12 {
54+
scope 14 (inlined #[track_caller] std::mem::Alignment::new_unchecked) {
55+
scope 15 (inlined core::ub_checks::check_language_ub) {
56+
scope 16 (inlined core::ub_checks::check_language_ub::runtime) {
57+
}
5658
}
5759
}
5860
}
59-
}
60-
scope 12 (inlined align_of_val_raw::<[u8; 1024]>) {
61+
scope 13 (inlined align_of_val_raw::<[u8; 1024]>) {
62+
}
6163
}
6264
}
6365
}

0 commit comments

Comments
 (0)