Skip to content

Commit 2348eb2

Browse files
committed
Update mir-opt tests, add proper regression test
1 parent ca79086 commit 2348eb2

12 files changed

+202
-518
lines changed

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

+28-84
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,26 @@
44
fn concrete() -> () {
55
let mut _0: ();
66
let _1: usize;
7-
let mut _2: usize;
8-
let mut _4: usize;
9-
let mut _6: usize;
10-
let mut _8: usize;
11-
let mut _10: usize;
12-
let mut _12: usize;
13-
let mut _14: usize;
147
scope 1 {
158
debug x => _1;
16-
let _3: usize;
9+
let _2: usize;
1710
scope 2 {
18-
debug y => _3;
19-
let _5: usize;
11+
debug y => _2;
12+
let _3: usize;
2013
scope 3 {
21-
debug z0 => _5;
22-
let _7: usize;
14+
debug z0 => _3;
15+
let _4: usize;
2316
scope 4 {
24-
debug z1 => _7;
25-
let _9: usize;
17+
debug z1 => _4;
18+
let _5: usize;
2619
scope 5 {
27-
debug eA0 => _9;
28-
let _11: usize;
20+
debug eA0 => _5;
21+
let _6: usize;
2922
scope 6 {
30-
debug eA1 => _11;
31-
let _13: usize;
23+
debug eA1 => _6;
24+
let _7: usize;
3225
scope 7 {
33-
debug eC => _13;
26+
debug eC => _7;
3427
}
3528
}
3629
}
@@ -41,82 +34,33 @@
4134

4235
bb0: {
4336
StorageLive(_1);
37+
- _1 = OffsetOf(Alpha, [(0, 0)]);
38+
+ _1 = const 4_usize;
4439
StorageLive(_2);
45-
- _2 = OffsetOf(Alpha, [(0, 0)]);
46-
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind unreachable];
47-
+ _2 = const 4_usize;
48-
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind unreachable];
49-
}
50-
51-
bb1: {
52-
StorageDead(_2);
40+
- _2 = OffsetOf(Alpha, [(0, 1)]);
41+
+ _2 = const 0_usize;
5342
StorageLive(_3);
43+
- _3 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
44+
+ _3 = const 2_usize;
5445
StorageLive(_4);
55-
- _4 = OffsetOf(Alpha, [(0, 1)]);
56-
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind unreachable];
57-
+ _4 = const 0_usize;
58-
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind unreachable];
59-
}
60-
61-
bb2: {
62-
StorageDead(_4);
46+
- _4 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
47+
+ _4 = const 3_usize;
6348
StorageLive(_5);
49+
- _5 = OffsetOf(Epsilon, [(0, 0)]);
50+
+ _5 = const 1_usize;
6451
StorageLive(_6);
65-
- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
66-
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind unreachable];
52+
- _6 = OffsetOf(Epsilon, [(0, 1)]);
6753
+ _6 = const 2_usize;
68-
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind unreachable];
69-
}
70-
71-
bb3: {
72-
StorageDead(_6);
7354
StorageLive(_7);
74-
StorageLive(_8);
75-
- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
76-
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind unreachable];
77-
+ _8 = const 3_usize;
78-
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind unreachable];
79-
}
80-
81-
bb4: {
82-
StorageDead(_8);
83-
StorageLive(_9);
84-
StorageLive(_10);
85-
- _10 = OffsetOf(Epsilon, [(0, 0)]);
86-
- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind unreachable];
87-
+ _10 = const 1_usize;
88-
+ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind unreachable];
89-
}
90-
91-
bb5: {
92-
StorageDead(_10);
93-
StorageLive(_11);
94-
StorageLive(_12);
95-
- _12 = OffsetOf(Epsilon, [(0, 1)]);
96-
- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind unreachable];
97-
+ _12 = const 2_usize;
98-
+ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind unreachable];
99-
}
100-
101-
bb6: {
102-
StorageDead(_12);
103-
StorageLive(_13);
104-
StorageLive(_14);
105-
- _14 = OffsetOf(Epsilon, [(2, 0)]);
106-
- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind unreachable];
107-
+ _14 = const 4_usize;
108-
+ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind unreachable];
109-
}
110-
111-
bb7: {
112-
StorageDead(_14);
55+
- _7 = OffsetOf(Epsilon, [(2, 0)]);
56+
+ _7 = const 4_usize;
11357
_0 = const ();
114-
StorageDead(_13);
115-
StorageDead(_11);
116-
StorageDead(_9);
11758
StorageDead(_7);
59+
StorageDead(_6);
11860
StorageDead(_5);
61+
StorageDead(_4);
11962
StorageDead(_3);
63+
StorageDead(_2);
12064
StorageDead(_1);
12165
return;
12266
}

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

+28-84
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,26 @@
44
fn concrete() -> () {
55
let mut _0: ();
66
let _1: usize;
7-
let mut _2: usize;
8-
let mut _4: usize;
9-
let mut _6: usize;
10-
let mut _8: usize;
11-
let mut _10: usize;
12-
let mut _12: usize;
13-
let mut _14: usize;
147
scope 1 {
158
debug x => _1;
16-
let _3: usize;
9+
let _2: usize;
1710
scope 2 {
18-
debug y => _3;
19-
let _5: usize;
11+
debug y => _2;
12+
let _3: usize;
2013
scope 3 {
21-
debug z0 => _5;
22-
let _7: usize;
14+
debug z0 => _3;
15+
let _4: usize;
2316
scope 4 {
24-
debug z1 => _7;
25-
let _9: usize;
17+
debug z1 => _4;
18+
let _5: usize;
2619
scope 5 {
27-
debug eA0 => _9;
28-
let _11: usize;
20+
debug eA0 => _5;
21+
let _6: usize;
2922
scope 6 {
30-
debug eA1 => _11;
31-
let _13: usize;
23+
debug eA1 => _6;
24+
let _7: usize;
3225
scope 7 {
33-
debug eC => _13;
26+
debug eC => _7;
3427
}
3528
}
3629
}
@@ -41,82 +34,33 @@
4134

4235
bb0: {
4336
StorageLive(_1);
37+
- _1 = OffsetOf(Alpha, [(0, 0)]);
38+
+ _1 = const 4_usize;
4439
StorageLive(_2);
45-
- _2 = OffsetOf(Alpha, [(0, 0)]);
46-
- _1 = must_use::<usize>(move _2) -> [return: bb1, unwind continue];
47-
+ _2 = const 4_usize;
48-
+ _1 = must_use::<usize>(const 4_usize) -> [return: bb1, unwind continue];
49-
}
50-
51-
bb1: {
52-
StorageDead(_2);
40+
- _2 = OffsetOf(Alpha, [(0, 1)]);
41+
+ _2 = const 0_usize;
5342
StorageLive(_3);
43+
- _3 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
44+
+ _3 = const 2_usize;
5445
StorageLive(_4);
55-
- _4 = OffsetOf(Alpha, [(0, 1)]);
56-
- _3 = must_use::<usize>(move _4) -> [return: bb2, unwind continue];
57-
+ _4 = const 0_usize;
58-
+ _3 = must_use::<usize>(const 0_usize) -> [return: bb2, unwind continue];
59-
}
60-
61-
bb2: {
62-
StorageDead(_4);
46+
- _4 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
47+
+ _4 = const 3_usize;
6348
StorageLive(_5);
49+
- _5 = OffsetOf(Epsilon, [(0, 0)]);
50+
+ _5 = const 1_usize;
6451
StorageLive(_6);
65-
- _6 = OffsetOf(Alpha, [(0, 2), (0, 0)]);
66-
- _5 = must_use::<usize>(move _6) -> [return: bb3, unwind continue];
52+
- _6 = OffsetOf(Epsilon, [(0, 1)]);
6753
+ _6 = const 2_usize;
68-
+ _5 = must_use::<usize>(const 2_usize) -> [return: bb3, unwind continue];
69-
}
70-
71-
bb3: {
72-
StorageDead(_6);
7354
StorageLive(_7);
74-
StorageLive(_8);
75-
- _8 = OffsetOf(Alpha, [(0, 2), (0, 1)]);
76-
- _7 = must_use::<usize>(move _8) -> [return: bb4, unwind continue];
77-
+ _8 = const 3_usize;
78-
+ _7 = must_use::<usize>(const 3_usize) -> [return: bb4, unwind continue];
79-
}
80-
81-
bb4: {
82-
StorageDead(_8);
83-
StorageLive(_9);
84-
StorageLive(_10);
85-
- _10 = OffsetOf(Epsilon, [(0, 0)]);
86-
- _9 = must_use::<usize>(move _10) -> [return: bb5, unwind continue];
87-
+ _10 = const 1_usize;
88-
+ _9 = must_use::<usize>(const 1_usize) -> [return: bb5, unwind continue];
89-
}
90-
91-
bb5: {
92-
StorageDead(_10);
93-
StorageLive(_11);
94-
StorageLive(_12);
95-
- _12 = OffsetOf(Epsilon, [(0, 1)]);
96-
- _11 = must_use::<usize>(move _12) -> [return: bb6, unwind continue];
97-
+ _12 = const 2_usize;
98-
+ _11 = must_use::<usize>(const 2_usize) -> [return: bb6, unwind continue];
99-
}
100-
101-
bb6: {
102-
StorageDead(_12);
103-
StorageLive(_13);
104-
StorageLive(_14);
105-
- _14 = OffsetOf(Epsilon, [(2, 0)]);
106-
- _13 = must_use::<usize>(move _14) -> [return: bb7, unwind continue];
107-
+ _14 = const 4_usize;
108-
+ _13 = must_use::<usize>(const 4_usize) -> [return: bb7, unwind continue];
109-
}
110-
111-
bb7: {
112-
StorageDead(_14);
55+
- _7 = OffsetOf(Epsilon, [(2, 0)]);
56+
+ _7 = const 4_usize;
11357
_0 = const ();
114-
StorageDead(_13);
115-
StorageDead(_11);
116-
StorageDead(_9);
11758
StorageDead(_7);
59+
StorageDead(_6);
11860
StorageDead(_5);
61+
StorageDead(_4);
11962
StorageDead(_3);
63+
StorageDead(_2);
12064
StorageDead(_1);
12165
return;
12266
}

0 commit comments

Comments
 (0)