summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix S. Klock II <pnkfelix@pnkfx.org>2018-05-09 13:16:43 +0200
committerFelix S. Klock II <pnkfelix@pnkfx.org>2018-05-29 23:02:40 +0200
commit5eebd36c93de007f10ede2458431f25fa80bb98f (patch)
tree06041604fcbf3d2ce30c9b609d3733d8c407df82
parentExpand two-phase-borrows so that a case like this still compiles: (diff)
downloadgrust-5eebd36c93de007f10ede2458431f25fa80bb98f.tar.gz
grust-5eebd36c93de007f10ede2458431f25fa80bb98f.tar.bz2
grust-5eebd36c93de007f10ede2458431f25fa80bb98f.tar.xz
Test update: Fallout from ReadForMatch statements + changes to codegen under NLL.
-rw-r--r--src/test/mir-opt/match_false_edges.rs237
1 files changed, 125 insertions, 112 deletions
diff --git a/src/test/mir-opt/match_false_edges.rs b/src/test/mir-opt/match_false_edges.rs
index c2a40399ef..739cbc0a99 100644
--- a/src/test/mir-opt/match_false_edges.rs
+++ b/src/test/mir-opt/match_false_edges.rs
@@ -54,60 +54,65 @@ fn main() {
54// ... 54// ...
55// _2 = std::option::Option<i32>::Some(const 42i32,); 55// _2 = std::option::Option<i32>::Some(const 42i32,);
56// _3 = discriminant(_2); 56// _3 = discriminant(_2);
57// _7 = discriminant(_2); 57// _14 = promoted[1];
58// switchInt(move _7) -> [0isize: bb6, 1isize: bb4, otherwise: bb8]; 58// _4 = &(*_14);
59// _9 = discriminant(_2);
60// switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
59// } 61// }
60// bb1: { 62// bb1: {
61// resume; 63// resume;
62// } 64// }
63// bb2: { // arm1 65// bb2: { // arm1
64// StorageLive(_9); 66// _1 = (const 3i32, const 3i32);
65// _9 = _4;
66// _1 = (const 1i32, move _9);
67// StorageDead(_9);
68// goto -> bb13; 67// goto -> bb13;
69// } 68// }
70// bb3: { // binding3(empty) and arm3 69// bb3: { // binding3(empty) and arm3
71// _1 = (const 3i32, const 3i32); 70// ReadForMatch(_4);
72// goto -> bb13; 71// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
73// } 72// }
74// bb4: { 73// bb4: {
75// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 74// ReadForMatch(_4);
75// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2
76// } 76// }
77// bb5: { 77// bb5: {
78// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 78// ReadForMatch(_4);
79// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3
79// } 80// }
80// bb6: { 81// bb6: {
81// falseEdges -> [real: bb3, imaginary: bb7]; //pre_binding3 82// unreachable;
82// } 83// }
83// bb7: { 84// bb7: {
84// unreachable; 85// unreachable;
85// } 86// }
86// bb8: { 87// bb8: { // binding1 and guard
87// unreachable; 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];
88// } 93// }
89// bb9: { // binding1 and guard 94// bb9: {
90// StorageLive(_5); 95// switchInt(move _10) -> [false: bb10, otherwise: bb11];
91// _11 = promoted[0];
92// _5 = &(((*_11) as Some).0: i32);
93// StorageLive(_8);
94// _8 = const guard() -> [return: bb10, unwind: bb1];
95// } 96// }
96// bb10: { // end of guard 97// bb10: { // to pre_binding2
97// StorageLive(_4); 98// falseEdges -> [real: bb4, imaginary: bb4];
98// _4 = ((_2 as Some).0: i32);
99// switchInt(move _8) -> [false: bb11, otherwise: bb2];
100// } 99// }
101// bb11: { // to pre_binding2 100// bb11: { // bindingNoLandingPads.before.mir2 and arm2
102// falseEdges -> [real: bb5, imaginary: bb5]; 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;
103// } 108// }
104// bb12: { // bindingNoLandingPads.before.mir2 and arm2 109// bb12: {
105// StorageLive(_6); 110// StorageLive(_8);
106// _6 = ((_2 as Some).0: i32); 111// _8 = ((_2 as Some).0: i32);
107// StorageLive(_10); 112// StorageLive(_12);
108// _10 = _6; 113// _12 = _8;
109// _1 = (const 2i32, move _10); 114// _1 = (const 2i32, move_12);
110// StorageDead(_10); 115// StorageDead(_12);
111// goto -> bb13; 116// goto -> bb13;
112// } 117// }
113// bb13: { 118// bb13: {
@@ -121,59 +126,63 @@ fn main() {
121// ... 126// ...
122// _2 = std::option::Option<i32>::Some(const 42i32,); 127// _2 = std::option::Option<i32>::Some(const 42i32,);
123// _3 = discriminant(_2); 128// _3 = discriminant(_2);
124// _7 = discriminant(_2); 129// _4 = &_2;
125// switchInt(move _7) -> [0isize: bb5, 1isize: bb4, otherwise: bb8]; 130// _9 = discriminant(_2);
131// switchInt(move _9) -> [0isize: bb4, 1isize: bb3, otherwise: bb7];
126// } 132// }
127// bb1: { 133// bb1: {
128// resume; 134// resume;
129// } 135// }
130// bb2: { // arm1 136// bb2: { // arm2
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
138// _1 = (const 3i32, const 3i32); 137// _1 = (const 3i32, const 3i32);
139// goto -> bb13; 138// goto -> bb13;
140// } 139// }
140// bb3: {
141// ReadForMatch(_4);
142// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
143// }
141// bb4: { 144// bb4: {
142// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 145// ReadForMatch(_4);
146// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2
143// } 147// }
144// bb5: { 148// bb5: {
145// falseEdges -> [real: bb3, imaginary: bb6]; //pre_binding2 149// ReadForMatch(_4);
150// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3
146// } 151// }
147// bb6: { 152// bb6: {
148// falseEdges -> [real: bb12, imaginary: bb7]; //pre_binding3 153// unreachable;
149// } 154// }
150// bb7: { 155// bb7: {
151// unreachable; 156// unreachable;
152// } 157// }
153// bb8: { 158// bb8: { // binding1 and guard
154// unreachable; 159// StorageLive(_7);
160// _7 = &((_2 as Some).0: i32);
161// StorageLive(_10);
162// _10 = const guard() -> [return: bb9, unwind: bb1];
155// } 163// }
156// bb9: { // binding1 and guard 164// bb9: { // end of guard
157// StorageLive(_5); 165// switchInt(move _10) -> [false: bb10, otherwise: bb11];
158// _5 = &((_2 as Some).0: i32);
159// StorageLive(_8);
160// _8 = const guard() -> [return: bb10, unwind: bb1];
161// } 166// }
162// bb10: { // end of guard 167// bb10: { // to pre_binding3 (can skip 2 since this is `Some`)
163// StorageLive(_4); 168// falseEdges -> [real: bb5, imaginary: bb4];
164// _4 = ((_2 as Some).0: i32);
165// switchInt(move _8) -> [false: bb11, otherwise: bb2];
166// } 169// }
167// bb11: { // to pre_binding2 170// bb11: { // arm1
168// falseEdges -> [real: bb6, imaginary: bb5]; 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;
169// } 178// }
170// bb12: { // binding2 and arm2 179// bb12: { // binding3 and arm3
171// StorageLive(_6); 180// StorageLive(_8);
172// _6 = ((_2 as Some).0: i32); 181// _8 = ((_2 as Some).0: i32);
173// StorageLive(_10); 182// StorageLive(_12);
174// _10 = _6; 183// _12 = _8;
175// _1 = (const 2i32, move _10); 184// _1 = (const 2i32, move _12);
176// StorageDead(_10); 185// StorageDead(_12);
177// goto -> bb13; 186// goto -> bb13;
178// } 187// }
179// bb13: { 188// bb13: {
@@ -187,76 +196,80 @@ fn main() {
187// ... 196// ...
188// _2 = std::option::Option<i32>::Some(const 1i32,); 197// _2 = std::option::Option<i32>::Some(const 1i32,);
189// _3 = discriminant(_2); 198// _3 = discriminant(_2);
190// _10 = discriminant(_2); 199// _4 = &_2;
191// switchInt(move _10) -> [1isize: bb4, otherwise: bb5]; 200// _13 = discriminant(_2);
201// switchInt(move _13) -> [1isize: bb2, otherwise: bb3];
192// } 202// }
193// bb1: { 203// bb1: {
194// resume; 204// resume;
195// } 205// }
196// bb2: { // arm1 206// bb2: {
197// _1 = const 1i32; 207// ReadForMatch(_4);
198// goto -> bb17; 208// falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1
199// } 209// }
200// bb3: { // arm3 210// bb3: {
201// _1 = const 3i32; 211// ReadForMatch(_4);
202// goto -> bb17; 212// falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2
203// } 213// }
204//
205// bb4: { 214// bb4: {
206// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 215// ReadForMatch(_4);
216// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3
207// } 217// }
208// bb5: { 218// bb5: {
209// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 219// ReadForMatch(_4);
220// falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4
210// } 221// }
211// bb6: { 222// bb6: {
212// falseEdges -> [real: bb13, imaginary: bb7]; //pre_binding3
213// }
214// bb7: {
215// falseEdges -> [real: bb16, imaginary: bb8]; //pre_binding4
216// }
217// bb8: {
218// unreachable; 223// unreachable;
219// } 224// }
220// bb9: { // binding1: Some(w) if guard() 225// bb7: { // binding1: Some(w) if guard()
221// StorageLive(_5); 226// StorageLive(_7);
222// _5 = &((_2 as Some).0: i32); 227// _7 = &((_2 as Some).0: i32);
223// StorageLive(_11); 228// StorageLive(_14);
224// _11 = const guard() -> [return: bb10, unwind: bb1]; 229// _14 = const guard() -> [return: bb8, unwind: bb1];
225// } 230// }
226// bb10: { //end of guard 231// bb8: { //end of guard
227// StorageLive(_4); 232// switchInt(move _14) -> [false: bb9, otherwise: bb10];
228// _4 = ((_2 as Some).0: i32);
229// switchInt(move _11) -> [false: bb11, otherwise: bb2];
230// } 233// }
231// bb11: { // to pre_binding2 234// bb9: { // to pre_binding2
232// falseEdges -> [real: bb5, imaginary: bb5]; 235// falseEdges -> [real: bb3, imaginary: bb3];
233// } 236// }
234// bb12: { // binding2 & arm2 237// bb10: { // set up bindings for arm1
235// StorageLive(_6); 238// StorageLive(_5);
236// _6 = _2; 239// _5 = ((_2 as Some).0: i32);
237// _1 = const 2i32; 240// _1 = const 1i32;
238// goto -> bb17; 241// goto -> bb17;
239// } 242// }
240// bb13: { // binding3: Some(y) if guard2(y) 243// bb11: { // binding2 & arm2
241// StorageLive(_8); 244// StorageLive(_8);
242// _8 = &((_2 as Some).0: i32); 245// _8 = _2;
243// StorageLive(_13); 246// _1 = const 2i32;
244// StorageLive(_14); 247// goto -> bb17;
245// _14 = (*_8);
246// _13 = const guard2(move _14) -> [return: bb14, unwind: bb1];
247// } 248// }
248// bb14: { // end of guard2 249// bb12: { // binding3: Some(y) if guard2(y)
249// StorageDead(_14); 250// StorageLive(_11);
250// StorageLive(_7); 251// _11 = &((_2 as Some).0: i32);
251// _7 = ((_2 as Some).0: i32); 252// StorageLive(_16);
252// switchInt(move _13) -> [false: bb15, otherwise: bb3]; 253// StorageLive(_17);
254// _17 = (*_11);
255// _16 = const guard2(move _17) -> [return: bb13, unwind: bb1];
253// } 256// }
254// bb15: { // to pre_binding4 257// bb13: { // end of guard2
255// falseEdges -> [real: bb7, imaginary: bb7]; 258// StorageDead(_17);
259// switchInt(move _16) -> [false: bb14, otherwise: bb15];
256// } 260// }
257// bb16: { // binding4 & arm4 261// bb14: { // to pre_binding4
262// falseEdges -> [real: bb5, imaginary: bb5];
263// }
264// bb15: { // set up bindings for arm3
258// StorageLive(_9); 265// 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;
260// _1 = const 4i32; 273// _1 = const 4i32;
261// goto -> bb17; 274// goto -> bb17;
262// } 275// }