Skip to content

Commit 5eebd36

Browse files
committed
Test update: Fallout from ReadForMatch statements + changes to codegen under NLL.
1 parent 3bc5073 commit 5eebd36

File tree

1 file changed

+125
-112
lines changed

1 file changed

+125
-112
lines changed

src/test/mir-opt/match_false_edges.rs

Lines changed: 125 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -54,60 +54,65 @@ fn main() {
5454
// ...
5555
// _2 = std::option::Option<i32>::Some(const 42i32,);
5656
// _3 = discriminant(_2);
57-
// _7 = discriminant(_2);
58-
// switchInt(move _7) -> [0isize: bb6, 1isize: bb4, otherwise: bb8];
57+
// _14 = promoted[1];
58+
// _4 = &(*_14);
59+
// _9 = discriminant(_2);
60+
// switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
5961
// }
6062
// bb1: {
6163
// resume;
6264
// }
6365
// bb2: { // arm1
64-
// StorageLive(_9);
65-
// _9 = _4;
66-
// _1 = (const 1i32, move _9);
67-
// StorageDead(_9);
66+
// _1 = (const 3i32, const 3i32);
6867
// goto -> bb13;
6968
// }
7069
// bb3: { // binding3(empty) and arm3
71-
// _1 = (const 3i32, const 3i32);
72-
// goto -> bb13;
70+
// ReadForMatch(_4);
71+
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
7372
// }
7473
// bb4: {
75-
// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1
74+
// ReadForMatch(_4);
75+
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2
7676
// }
7777
// bb5: {
78-
// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2
78+
// ReadForMatch(_4);
79+
// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3
7980
// }
8081
// bb6: {
81-
// falseEdges -> [real: bb3, imaginary: bb7]; //pre_binding3
82+
// unreachable;
8283
// }
8384
// bb7: {
8485
// unreachable;
8586
// }
86-
// bb8: {
87-
// unreachable;
87+
// bb8: { // binding1 and guard
88+
// StorageLive(_7);
89+
// _13 = promoted[0];
90+
// _7 = &(((*_13) as Some).0: i32);
91+
// StorageLive(_10);
92+
// _10 = const guard() -> [return: bb9, unwind: bb1];
8893
// }
89-
// bb9: { // binding1 and guard
90-
// StorageLive(_5);
91-
// _11 = promoted[0];
92-
// _5 = &(((*_11) as Some).0: i32);
93-
// StorageLive(_8);
94-
// _8 = const guard() -> [return: bb10, unwind: bb1];
94+
// bb9: {
95+
// switchInt(move _10) -> [false: bb10, otherwise: bb11];
9596
// }
96-
// bb10: { // end of guard
97-
// StorageLive(_4);
98-
// _4 = ((_2 as Some).0: i32);
99-
// switchInt(move _8) -> [false: bb11, otherwise: bb2];
97+
// bb10: { // to pre_binding2
98+
// falseEdges -> [real: bb4, imaginary: bb4];
10099
// }
101-
// bb11: { // to pre_binding2
102-
// falseEdges -> [real: bb5, imaginary: bb5];
100+
// bb11: { // bindingNoLandingPads.before.mir2 and arm2
101+
// StorageLive(_5);
102+
// _5 = ((_2 as Some).0: i32);
103+
// StorageLive(_11);
104+
// _11 = _5;
105+
// _1 = (const 1i32, move _11);
106+
// StorageDead(_11);
107+
// goto -> bb13;
103108
// }
104-
// bb12: { // bindingNoLandingPads.before.mir2 and arm2
105-
// StorageLive(_6);
106-
// _6 = ((_2 as Some).0: i32);
107-
// StorageLive(_10);
108-
// _10 = _6;
109-
// _1 = (const 2i32, move _10);
110-
// StorageDead(_10);
109+
// bb12: {
110+
// StorageLive(_8);
111+
// _8 = ((_2 as Some).0: i32);
112+
// StorageLive(_12);
113+
// _12 = _8;
114+
// _1 = (const 2i32, move_12);
115+
// StorageDead(_12);
111116
// goto -> bb13;
112117
// }
113118
// bb13: {
@@ -121,59 +126,63 @@ fn main() {
121126
// ...
122127
// _2 = std::option::Option<i32>::Some(const 42i32,);
123128
// _3 = discriminant(_2);
124-
// _7 = discriminant(_2);
125-
// switchInt(move _7) -> [0isize: bb5, 1isize: bb4, otherwise: bb8];
129+
// _4 = &_2;
130+
// _9 = discriminant(_2);
131+
// switchInt(move _9) -> [0isize: bb4, 1isize: bb3, otherwise: bb7];
126132
// }
127133
// bb1: {
128134
// resume;
129135
// }
130-
// bb2: { // arm1
131-
// StorageLive(_9);
132-
// _9 = _4;
133-
// _1 = (const 1i32, move _9);
134-
// StorageDead(_9);
135-
// goto -> bb13;
136-
// }
137-
// bb3: { // binding3(empty) and arm3
136+
// bb2: { // arm2
138137
// _1 = (const 3i32, const 3i32);
139138
// goto -> bb13;
140139
// }
140+
// bb3: {
141+
// ReadForMatch(_4);
142+
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
143+
// }
141144
// bb4: {
142-
// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1
145+
// ReadForMatch(_4);
146+
// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2
143147
// }
144148
// bb5: {
145-
// falseEdges -> [real: bb3, imaginary: bb6]; //pre_binding2
149+
// ReadForMatch(_4);
150+
// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3
146151
// }
147152
// bb6: {
148-
// falseEdges -> [real: bb12, imaginary: bb7]; //pre_binding3
153+
// unreachable;
149154
// }
150155
// bb7: {
151156
// unreachable;
152157
// }
153-
// bb8: {
154-
// unreachable;
158+
// bb8: { // binding1 and guard
159+
// StorageLive(_7);
160+
// _7 = &((_2 as Some).0: i32);
161+
// StorageLive(_10);
162+
// _10 = const guard() -> [return: bb9, unwind: bb1];
155163
// }
156-
// bb9: { // binding1 and guard
157-
// StorageLive(_5);
158-
// _5 = &((_2 as Some).0: i32);
159-
// StorageLive(_8);
160-
// _8 = const guard() -> [return: bb10, unwind: bb1];
164+
// bb9: { // end of guard
165+
// switchInt(move _10) -> [false: bb10, otherwise: bb11];
161166
// }
162-
// bb10: { // end of guard
163-
// StorageLive(_4);
164-
// _4 = ((_2 as Some).0: i32);
165-
// switchInt(move _8) -> [false: bb11, otherwise: bb2];
167+
// bb10: { // to pre_binding3 (can skip 2 since this is `Some`)
168+
// falseEdges -> [real: bb5, imaginary: bb4];
166169
// }
167-
// bb11: { // to pre_binding2
168-
// falseEdges -> [real: bb6, imaginary: bb5];
170+
// bb11: { // arm1
171+
// StorageLive(_5);
172+
// _5 = ((_2 as Some).0: i32);
173+
// StorageLive(_11);
174+
// _11 = _5;
175+
// _1 = (const 1i32, move _11);
176+
// StorageDead(_11);
177+
// goto -> bb13;
169178
// }
170-
// bb12: { // binding2 and arm2
171-
// StorageLive(_6);
172-
// _6 = ((_2 as Some).0: i32);
173-
// StorageLive(_10);
174-
// _10 = _6;
175-
// _1 = (const 2i32, move _10);
176-
// StorageDead(_10);
179+
// bb12: { // binding3 and arm3
180+
// StorageLive(_8);
181+
// _8 = ((_2 as Some).0: i32);
182+
// StorageLive(_12);
183+
// _12 = _8;
184+
// _1 = (const 2i32, move _12);
185+
// StorageDead(_12);
177186
// goto -> bb13;
178187
// }
179188
// bb13: {
@@ -187,76 +196,80 @@ fn main() {
187196
// ...
188197
// _2 = std::option::Option<i32>::Some(const 1i32,);
189198
// _3 = discriminant(_2);
190-
// _10 = discriminant(_2);
191-
// switchInt(move _10) -> [1isize: bb4, otherwise: bb5];
199+
// _4 = &_2;
200+
// _13 = discriminant(_2);
201+
// switchInt(move _13) -> [1isize: bb2, otherwise: bb3];
192202
// }
193203
// bb1: {
194204
// resume;
195205
// }
196-
// bb2: { // arm1
197-
// _1 = const 1i32;
198-
// goto -> bb17;
206+
// bb2: {
207+
// ReadForMatch(_4);
208+
// falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1
199209
// }
200-
// bb3: { // arm3
201-
// _1 = const 3i32;
202-
// goto -> bb17;
210+
// bb3: {
211+
// ReadForMatch(_4);
212+
// falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2
203213
// }
204-
//
205214
// bb4: {
206-
// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1
215+
// ReadForMatch(_4);
216+
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3
207217
// }
208218
// bb5: {
209-
// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2
219+
// ReadForMatch(_4);
220+
// falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4
210221
// }
211222
// bb6: {
212-
// falseEdges -> [real: bb13, imaginary: bb7]; //pre_binding3
213-
// }
214-
// bb7: {
215-
// falseEdges -> [real: bb16, imaginary: bb8]; //pre_binding4
216-
// }
217-
// bb8: {
218223
// unreachable;
219224
// }
220-
// bb9: { // binding1: Some(w) if guard()
221-
// StorageLive(_5);
222-
// _5 = &((_2 as Some).0: i32);
223-
// StorageLive(_11);
224-
// _11 = const guard() -> [return: bb10, unwind: bb1];
225+
// bb7: { // binding1: Some(w) if guard()
226+
// StorageLive(_7);
227+
// _7 = &((_2 as Some).0: i32);
228+
// StorageLive(_14);
229+
// _14 = const guard() -> [return: bb8, unwind: bb1];
225230
// }
226-
// bb10: { //end of guard
227-
// StorageLive(_4);
228-
// _4 = ((_2 as Some).0: i32);
229-
// switchInt(move _11) -> [false: bb11, otherwise: bb2];
231+
// bb8: { //end of guard
232+
// switchInt(move _14) -> [false: bb9, otherwise: bb10];
230233
// }
231-
// bb11: { // to pre_binding2
232-
// falseEdges -> [real: bb5, imaginary: bb5];
234+
// bb9: { // to pre_binding2
235+
// falseEdges -> [real: bb3, imaginary: bb3];
233236
// }
234-
// bb12: { // binding2 & arm2
235-
// StorageLive(_6);
236-
// _6 = _2;
237-
// _1 = const 2i32;
237+
// bb10: { // set up bindings for arm1
238+
// StorageLive(_5);
239+
// _5 = ((_2 as Some).0: i32);
240+
// _1 = const 1i32;
238241
// goto -> bb17;
239242
// }
240-
// bb13: { // binding3: Some(y) if guard2(y)
243+
// bb11: { // binding2 & arm2
241244
// StorageLive(_8);
242-
// _8 = &((_2 as Some).0: i32);
243-
// StorageLive(_13);
244-
// StorageLive(_14);
245-
// _14 = (*_8);
246-
// _13 = const guard2(move _14) -> [return: bb14, unwind: bb1];
245+
// _8 = _2;
246+
// _1 = const 2i32;
247+
// goto -> bb17;
247248
// }
248-
// bb14: { // end of guard2
249-
// StorageDead(_14);
250-
// StorageLive(_7);
251-
// _7 = ((_2 as Some).0: i32);
252-
// switchInt(move _13) -> [false: bb15, otherwise: bb3];
249+
// bb12: { // binding3: Some(y) if guard2(y)
250+
// StorageLive(_11);
251+
// _11 = &((_2 as Some).0: i32);
252+
// StorageLive(_16);
253+
// StorageLive(_17);
254+
// _17 = (*_11);
255+
// _16 = const guard2(move _17) -> [return: bb13, unwind: bb1];
253256
// }
254-
// bb15: { // to pre_binding4
255-
// falseEdges -> [real: bb7, imaginary: bb7];
257+
// bb13: { // end of guard2
258+
// StorageDead(_17);
259+
// switchInt(move _16) -> [false: bb14, otherwise: bb15];
256260
// }
257-
// bb16: { // binding4 & arm4
261+
// bb14: { // to pre_binding4
262+
// falseEdges -> [real: bb5, imaginary: bb5];
263+
// }
264+
// bb15: { // set up bindings for arm3
258265
// StorageLive(_9);
259-
// _9 = _2;
266+
// _9 = ((_2 as Some).0: i32);
267+
// _1 = const 3i32;
268+
// goto -> bb17;
269+
// }
270+
// bb16: { // binding4 & arm4
271+
// StorageLive(_12);
272+
// _12 = _2;
260273
// _1 = const 4i32;
261274
// goto -> bb17;
262275
// }

0 commit comments

Comments
 (0)