Skip to content

Commit 531e98a

Browse files
committed
Update mir opt tests
1 parent f71f733 commit 531e98a

File tree

6 files changed

+88
-81
lines changed

6 files changed

+88
-81
lines changed

src/test/mir-opt/box_expr.rs

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ impl Drop for S {
6363
//
6464
// bb4: {
6565
// StorageDead(_2);
66-
// FakeRead(ForLet, _1);
6766
// StorageLive(_4);
6867
// _4 = move _1;
6968
// _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7];

src/test/mir-opt/issue-49232.rs

+10-11
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,9 @@ fn main() {
3434
// }
3535
// let mut _1: ();
3636
// let mut _3: bool;
37-
// let mut _4: u8;
38-
// let mut _5: !;
39-
// let mut _6: ();
40-
// let mut _7: &i32;
37+
// let mut _4: !;
38+
// let mut _5: ();
39+
// let mut _6: &i32;
4140
// bb0: {
4241
// goto -> bb1;
4342
// }
@@ -51,7 +50,7 @@ fn main() {
5150
// StorageLive(_2);
5251
// StorageLive(_3);
5352
// _3 = const true;
54-
// _4 = discriminant(_3);
53+
// FakeRead(ForMatchedPlace, _3);
5554
// switchInt(_3) -> [false: bb11, otherwise: bb10];
5655
// }
5756
// bb4: {
@@ -89,9 +88,9 @@ fn main() {
8988
// bb14: {
9089
// FakeRead(ForLet, _2);
9190
// StorageDead(_3);
92-
// StorageLive(_7);
93-
// _7 = &_2;
94-
// _6 = const std::mem::drop(move _7) -> [return: bb28, unwind: bb4];
91+
// StorageLive(_6);
92+
// _6 = &_2;
93+
// _5 = const std::mem::drop(move _6) -> [return: bb28, unwind: bb4];
9594
// }
9695
// bb15: {
9796
// goto -> bb16;
@@ -129,15 +128,15 @@ fn main() {
129128
// goto -> bb2;
130129
// }
131130
// bb26: {
132-
// _5 = ();
131+
// _4 = ();
133132
// unreachable;
134133
// }
135134
// bb27: {
136-
// StorageDead(_5);
135+
// StorageDead(_4);
137136
// goto -> bb14;
138137
// }
139138
// bb28: {
140-
// StorageDead(_7);
139+
// StorageDead(_6);
141140
// _1 = ();
142141
// StorageDead(_2);
143142
// goto -> bb1;

src/test/mir-opt/match_false_edges.rs

+78-65
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,11 @@ fn main() {
5353
// bb0: {
5454
// ...
5555
// _2 = std::option::Option<i32>::Some(const 42i32,);
56-
// _3 = discriminant(_2);
57-
// _4 = &(promoted[1]: std::option::Option<i32>);
58-
// _9 = discriminant(_2);
59-
// switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
56+
// FakeRead(ForMatchedPlace, _2);
57+
// _7 = discriminant(_2);
58+
// _9 = &shallow (promoted[2]: std::option::Option<i32>);
59+
// _10 = &(((promoted[1]: std::option::Option<i32>) as Some).0: i32);
60+
// switchInt(move _7) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
6061
// }
6162
// bb1: {
6263
// resume;
@@ -66,15 +67,18 @@ fn main() {
6667
// goto -> bb13;
6768
// }
6869
// bb3: { // binding3(empty) and arm3
69-
// FakeRead(ForMatch, _4);
70+
// FakeRead(ForMatchGuard, _9);
71+
// FakeRead(ForMatchGuard, _10);
7072
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
7173
// }
7274
// bb4: {
73-
// FakeRead(ForMatch, _4);
75+
// FakeRead(ForMatchGuard, _9);
76+
// FakeRead(ForMatchGuard, _10);
7477
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2
7578
// }
7679
// bb5: {
77-
// FakeRead(ForMatch, _4);
80+
// FakeRead(ForMatchGuard, _9);
81+
// FakeRead(ForMatchGuard, _10);
7882
// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3
7983
// }
8084
// bb6: {
@@ -84,31 +88,31 @@ fn main() {
8488
// unreachable;
8589
// }
8690
// bb8: { // binding1 and guard
87-
// StorageLive(_7);
88-
// _7 = &(((promoted[0]: std::option::Option<i32>) as Some).0: i32);
89-
// StorageLive(_10);
90-
// _10 = const guard() -> [return: bb9, unwind: bb1];
91+
// StorageLive(_5);
92+
// _5 = &(((promoted[0]: std::option::Option<i32>) as Some).0: i32);
93+
// StorageLive(_8);
94+
// _8 = const guard() -> [return: bb9, unwind: bb1];
9195
// }
9296
// bb9: {
93-
// switchInt(move _10) -> [false: bb10, otherwise: bb11];
97+
// switchInt(move _8) -> [false: bb10, otherwise: bb11];
9498
// }
9599
// bb10: { // to pre_binding2
96100
// falseEdges -> [real: bb4, imaginary: bb4];
97101
// }
98102
// bb11: { // bindingNoLandingPads.before.mir2 and arm2
99-
// StorageLive(_5);
100-
// _5 = ((_2 as Some).0: i32);
103+
// StorageLive(_3);
104+
// _3 = ((_2 as Some).0: i32);
101105
// StorageLive(_11);
102-
// _11 = _5;
106+
// _11 = _3;
103107
// _1 = (const 1i32, move _11);
104108
// StorageDead(_11);
105109
// goto -> bb13;
106110
// }
107111
// bb12: {
108-
// StorageLive(_8);
109-
// _8 = ((_2 as Some).0: i32);
112+
// StorageLive(_6);
113+
// _6 = ((_2 as Some).0: i32);
110114
// StorageLive(_12);
111-
// _12 = _8;
115+
// _12 = _6;
112116
// _1 = (const 2i32, move_12);
113117
// StorageDead(_12);
114118
// goto -> bb13;
@@ -123,10 +127,11 @@ fn main() {
123127
// bb0: {
124128
// ...
125129
// _2 = std::option::Option<i32>::Some(const 42i32,);
126-
// _3 = discriminant(_2);
127-
// _4 = &_2;
128-
// _9 = discriminant(_2);
129-
// switchInt(move _9) -> [0isize: bb4, 1isize: bb3, otherwise: bb7];
130+
// FakeRead(ForMatchedPlace, _2);
131+
// _7 = discriminant(_2);
132+
// _9 = &shallow _2;
133+
// _10 = &((_2 as Some).0: i32);
134+
// switchInt(move _7) -> [0isize: bb4, 1isize: bb3, otherwise: bb7];
130135
// }
131136
// bb1: {
132137
// resume;
@@ -136,15 +141,18 @@ fn main() {
136141
// goto -> bb13;
137142
// }
138143
// bb3: {
139-
// FakeRead(ForMatch, _4);
144+
// FakeRead(ForMatchGuard, _9);
145+
// FakeRead(ForMatchGuard, _10);
140146
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
141147
// }
142148
// bb4: {
143-
// FakeRead(ForMatch, _4);
149+
// FakeRead(ForMatchGuard, _9);
150+
// FakeRead(ForMatchGuard, _10);
144151
// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2
145152
// }
146153
// bb5: {
147-
// FakeRead(ForMatch, _4);
154+
// FakeRead(ForMatchGuard, _9);
155+
// FakeRead(ForMatchGuard, _10);
148156
// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3
149157
// }
150158
// bb6: {
@@ -154,31 +162,31 @@ fn main() {
154162
// unreachable;
155163
// }
156164
// bb8: { // binding1 and guard
157-
// StorageLive(_7);
158-
// _7 = &((_2 as Some).0: i32);
159-
// StorageLive(_10);
160-
// _10 = const guard() -> [return: bb9, unwind: bb1];
165+
// StorageLive(_5);
166+
// _5 = &((_2 as Some).0: i32);
167+
// StorageLive(_8);
168+
// _8 = const guard() -> [return: bb9, unwind: bb1];
161169
// }
162170
// bb9: { // end of guard
163-
// switchInt(move _10) -> [false: bb10, otherwise: bb11];
171+
// switchInt(move _8) -> [false: bb10, otherwise: bb11];
164172
// }
165173
// bb10: { // to pre_binding3 (can skip 2 since this is `Some`)
166174
// falseEdges -> [real: bb5, imaginary: bb4];
167175
// }
168176
// bb11: { // arm1
169-
// StorageLive(_5);
170-
// _5 = ((_2 as Some).0: i32);
177+
// StorageLive(_3);
178+
// _3 = ((_2 as Some).0: i32);
171179
// StorageLive(_11);
172-
// _11 = _5;
180+
// _11 = _3;
173181
// _1 = (const 1i32, move _11);
174182
// StorageDead(_11);
175183
// goto -> bb13;
176184
// }
177185
// bb12: { // binding3 and arm3
178-
// StorageLive(_8);
179-
// _8 = ((_2 as Some).0: i32);
186+
// StorageLive(_6);
187+
// _6 = ((_2 as Some).0: i32);
180188
// StorageLive(_12);
181-
// _12 = _8;
189+
// _12 = _6;
182190
// _1 = (const 2i32, move _12);
183191
// StorageDead(_12);
184192
// goto -> bb13;
@@ -193,81 +201,86 @@ fn main() {
193201
// bb0: {
194202
// ...
195203
// _2 = std::option::Option<i32>::Some(const 1i32,);
196-
// _3 = discriminant(_2);
197-
// _4 = &_2;
198-
// _13 = discriminant(_2);
199-
// switchInt(move _13) -> [1isize: bb2, otherwise: bb3];
204+
// FakeRead(ForMatchedPlace, _2);
205+
// _11 = discriminant(_2);
206+
// _16 = &shallow _2;
207+
// _17 = &((_2 as Some).0: i32);
208+
// switchInt(move _11) -> [1isize: bb2, otherwise: bb3];
200209
// }
201210
// bb1: {
202211
// resume;
203212
// }
204213
// bb2: {
205-
// FakeRead(ForMatch, _4);
214+
// FakeRead(ForMatchGuard, _16);
215+
// FakeRead(ForMatchGuard, _17);
206216
// falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1
207217
// }
208218
// bb3: {
209-
// FakeRead(ForMatch, _4);
219+
// FakeRead(ForMatchGuard, _16);
220+
// FakeRead(ForMatchGuard, _17);
210221
// falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2
211222
// }
212223
// bb4: {
213-
// FakeRead(ForMatch, _4);
224+
// FakeRead(ForMatchGuard, _16);
225+
// FakeRead(ForMatchGuard, _17);
214226
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3
215227
// }
216228
// bb5: {
217-
// FakeRead(ForMatch, _4);
229+
// FakeRead(ForMatchGuard, _16);
230+
// FakeRead(ForMatchGuard, _17);
218231
// falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4
219232
// }
220233
// bb6: {
221234
// unreachable;
222235
// }
223236
// bb7: { // binding1: Some(w) if guard()
224-
// StorageLive(_7);
225-
// _7 = &((_2 as Some).0: i32);
226-
// StorageLive(_14);
227-
// _14 = const guard() -> [return: bb8, unwind: bb1];
237+
// StorageLive(_5);
238+
// _5 = &((_2 as Some).0: i32);
239+
// StorageLive(_12);
240+
// _12 = const guard() -> [return: bb8, unwind: bb1];
228241
// }
229242
// bb8: { //end of guard
230-
// switchInt(move _14) -> [false: bb9, otherwise: bb10];
243+
// switchInt(move _12) -> [false: bb9, otherwise: bb10];
231244
// }
232245
// bb9: { // to pre_binding2
233246
// falseEdges -> [real: bb3, imaginary: bb3];
234247
// }
235248
// bb10: { // set up bindings for arm1
236-
// StorageLive(_5);
237-
// _5 = ((_2 as Some).0: i32);
249+
// StorageLive(_3);
250+
// _3 = ((_2 as Some).0: i32);
238251
// _1 = const 1i32;
239252
// goto -> bb17;
240253
// }
241254
// bb11: { // binding2 & arm2
242-
// StorageLive(_8);
243-
// _8 = _2;
255+
// StorageLive(_6);
256+
// _6 = _2;
244257
// _1 = const 2i32;
245258
// goto -> bb17;
246259
// }
247260
// bb12: { // binding3: Some(y) if guard2(y)
248-
// StorageLive(_11);
249-
// _11 = &((_2 as Some).0: i32);
250-
// StorageLive(_16);
251-
// StorageLive(_17);
252-
// _17 = (*_11);
253-
// _16 = const guard2(move _17) -> [return: bb13, unwind: bb1];
261+
// StorageLive(_9);
262+
// _9 = &((_2 as Some).0: i32);
263+
// StorageLive(_14);
264+
// StorageLive(_15);
265+
// _15 = (*_9);
266+
// _14 = const guard2(move _15) -> [return: bb13, unwind: bb1];
254267
// }
255268
// bb13: { // end of guard2
256-
// StorageDead(_17);
257-
// switchInt(move _16) -> [false: bb14, otherwise: bb15];
269+
// StorageDead(_15);
270+
// switchInt(move _14) -> [false: bb14, otherwise: bb15];
258271
// }
259272
// bb14: { // to pre_binding4
260273
// falseEdges -> [real: bb5, imaginary: bb5];
261274
// }
262275
// bb15: { // set up bindings for arm3
263-
// StorageLive(_9);
264-
// _9 = ((_2 as Some).0: i32);
276+
// StorageLive(_7);
277+
// _7 = ((_2 as Some).0: i32);
265278
// _1 = const 3i32;
266279
// goto -> bb17;
267280
// }
268281
// bb16: { // binding4 & arm4
269-
// StorageLive(_12);
270-
// _12 = _2;
282+
// StorageLive(_10);
283+
// _10 = _2;
271284
// _1 = const 4i32;
272285
// goto -> bb17;
273286
// }

src/test/mir-opt/validate_1.rs

-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ fn main() {
6767
// Validate(Suspend(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 })), [(*_2): i32]);
6868
// _3 = &ReErased (*_2);
6969
// Validate(Acquire, [(*_3): i32/ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 }) (imm)]);
70-
// FakeRead(ForLet, _3);
7170
// _0 = (*_3);
7271
// EndRegion(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 }));
7372
// StorageDead(_3);

src/test/mir-opt/validate_2.rs

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ fn main() {
2828
// Validate(Acquire, [_1: std::boxed::Box<[i32]>]);
2929
// StorageDead(_2);
3030
// StorageDead(_3);
31-
// FakeRead(ForLet, _1);
3231
// _0 = ();
3332
// Validate(Release, [_1: std::boxed::Box<[i32]>]);
3433
// drop(_1) -> [return: bb2, unwind: bb3];

src/test/mir-opt/validate_3.rs

-2
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ fn main() {
4747
// bb0: {
4848
// StorageLive(_1);
4949
// _1 = Test { x: const 0i32 };
50-
// FakeRead(ForLet, _1);
5150
// StorageLive(_2);
5251
// Validate(Suspend(ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 })), [_1: Test]);
5352
// _2 = &ReErased _1;
5453
// Validate(Acquire, [(*_2): Test/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]);
55-
// FakeRead(ForLet, _2);
5654
// StorageLive(_4);
5755
// StorageLive(_5);
5856
// Validate(Suspend(ReScope(Node(ItemLocalId(18)))), [((*_2).0: i32): i32/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]);

0 commit comments

Comments
 (0)