diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-05-09 13:16:43 +0200 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2018-05-29 23:02:40 +0200 |
| commit | 5eebd36c93de007f10ede2458431f25fa80bb98f (patch) | |
| tree | 06041604fcbf3d2ce30c9b609d3733d8c407df82 | |
| parent | 3bc5073dbb9e284a64ae8815bdb54d3b1d6c484a (diff) | |
| download | rust-5eebd36c93de007f10ede2458431f25fa80bb98f.tar.gz rust-5eebd36c93de007f10ede2458431f25fa80bb98f.zip | |
Test update: Fallout from ReadForMatch statements + changes to codegen under NLL.
| -rw-r--r-- | src/test/mir-opt/match_false_edges.rs | 237 |
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 c2a40399efe..739cbc0a996 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() { // ... // _2 = std::option::Option<i32>::Some(const 42i32,); // _3 = discriminant(_2); -// _7 = discriminant(_2); -// switchInt(move _7) -> [0isize: bb6, 1isize: bb4, otherwise: bb8]; +// _14 = promoted[1]; +// _4 = &(*_14); +// _9 = discriminant(_2); +// switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7]; // } // bb1: { // resume; // } // bb2: { // arm1 -// StorageLive(_9); -// _9 = _4; -// _1 = (const 1i32, move _9); -// StorageDead(_9); +// _1 = (const 3i32, const 3i32); // goto -> bb13; // } // bb3: { // binding3(empty) and arm3 -// _1 = (const 3i32, const 3i32); -// goto -> bb13; +// ReadForMatch(_4); +// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 // } // bb4: { -// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 +// ReadForMatch(_4); +// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2 // } // bb5: { -// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 +// ReadForMatch(_4); +// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3 // } // bb6: { -// falseEdges -> [real: bb3, imaginary: bb7]; //pre_binding3 +// unreachable; // } // bb7: { // unreachable; // } -// bb8: { -// unreachable; +// bb8: { // binding1 and guard +// StorageLive(_7); +// _13 = promoted[0]; +// _7 = &(((*_13) as Some).0: i32); +// StorageLive(_10); +// _10 = const guard() -> [return: bb9, unwind: bb1]; // } -// bb9: { // binding1 and guard -// StorageLive(_5); -// _11 = promoted[0]; -// _5 = &(((*_11) as Some).0: i32); -// StorageLive(_8); -// _8 = const guard() -> [return: bb10, unwind: bb1]; +// bb9: { +// switchInt(move _10) -> [false: bb10, otherwise: bb11]; // } -// bb10: { // end of guard -// StorageLive(_4); -// _4 = ((_2 as Some).0: i32); -// switchInt(move _8) -> [false: bb11, otherwise: bb2]; +// bb10: { // to pre_binding2 +// falseEdges -> [real: bb4, imaginary: bb4]; // } -// bb11: { // to pre_binding2 -// falseEdges -> [real: bb5, imaginary: bb5]; +// bb11: { // bindingNoLandingPads.before.mir2 and arm2 +// StorageLive(_5); +// _5 = ((_2 as Some).0: i32); +// StorageLive(_11); +// _11 = _5; +// _1 = (const 1i32, move _11); +// StorageDead(_11); +// goto -> bb13; // } -// bb12: { // bindingNoLandingPads.before.mir2 and arm2 -// StorageLive(_6); -// _6 = ((_2 as Some).0: i32); -// StorageLive(_10); -// _10 = _6; -// _1 = (const 2i32, move _10); -// StorageDead(_10); +// bb12: { +// StorageLive(_8); +// _8 = ((_2 as Some).0: i32); +// StorageLive(_12); +// _12 = _8; +// _1 = (const 2i32, move_12); +// StorageDead(_12); // goto -> bb13; // } // bb13: { @@ -121,59 +126,63 @@ fn main() { // ... // _2 = std::option::Option<i32>::Some(const 42i32,); // _3 = discriminant(_2); -// _7 = discriminant(_2); -// switchInt(move _7) -> [0isize: bb5, 1isize: bb4, otherwise: bb8]; +// _4 = &_2; +// _9 = discriminant(_2); +// switchInt(move _9) -> [0isize: bb4, 1isize: bb3, otherwise: bb7]; // } // bb1: { // resume; // } -// bb2: { // arm1 -// StorageLive(_9); -// _9 = _4; -// _1 = (const 1i32, move _9); -// StorageDead(_9); -// goto -> bb13; -// } -// bb3: { // binding3(empty) and arm3 +// bb2: { // arm2 // _1 = (const 3i32, const 3i32); // goto -> bb13; // } +// bb3: { +// ReadForMatch(_4); +// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 +// } // bb4: { -// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 +// ReadForMatch(_4); +// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2 // } // bb5: { -// falseEdges -> [real: bb3, imaginary: bb6]; //pre_binding2 +// ReadForMatch(_4); +// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3 // } // bb6: { -// falseEdges -> [real: bb12, imaginary: bb7]; //pre_binding3 +// unreachable; // } // bb7: { // unreachable; // } -// bb8: { -// unreachable; +// bb8: { // binding1 and guard +// StorageLive(_7); +// _7 = &((_2 as Some).0: i32); +// StorageLive(_10); +// _10 = const guard() -> [return: bb9, unwind: bb1]; // } -// bb9: { // binding1 and guard -// StorageLive(_5); -// _5 = &((_2 as Some).0: i32); -// StorageLive(_8); -// _8 = const guard() -> [return: bb10, unwind: bb1]; +// bb9: { // end of guard +// switchInt(move _10) -> [false: bb10, otherwise: bb11]; // } -// bb10: { // end of guard -// StorageLive(_4); -// _4 = ((_2 as Some).0: i32); -// switchInt(move _8) -> [false: bb11, otherwise: bb2]; +// bb10: { // to pre_binding3 (can skip 2 since this is `Some`) +// falseEdges -> [real: bb5, imaginary: bb4]; // } -// bb11: { // to pre_binding2 -// falseEdges -> [real: bb6, imaginary: bb5]; +// bb11: { // arm1 +// StorageLive(_5); +// _5 = ((_2 as Some).0: i32); +// StorageLive(_11); +// _11 = _5; +// _1 = (const 1i32, move _11); +// StorageDead(_11); +// goto -> bb13; // } -// bb12: { // binding2 and arm2 -// StorageLive(_6); -// _6 = ((_2 as Some).0: i32); -// StorageLive(_10); -// _10 = _6; -// _1 = (const 2i32, move _10); -// StorageDead(_10); +// bb12: { // binding3 and arm3 +// StorageLive(_8); +// _8 = ((_2 as Some).0: i32); +// StorageLive(_12); +// _12 = _8; +// _1 = (const 2i32, move _12); +// StorageDead(_12); // goto -> bb13; // } // bb13: { @@ -187,76 +196,80 @@ fn main() { // ... // _2 = std::option::Option<i32>::Some(const 1i32,); // _3 = discriminant(_2); -// _10 = discriminant(_2); -// switchInt(move _10) -> [1isize: bb4, otherwise: bb5]; +// _4 = &_2; +// _13 = discriminant(_2); +// switchInt(move _13) -> [1isize: bb2, otherwise: bb3]; // } // bb1: { // resume; // } -// bb2: { // arm1 -// _1 = const 1i32; -// goto -> bb17; +// bb2: { +// ReadForMatch(_4); +// falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1 // } -// bb3: { // arm3 -// _1 = const 3i32; -// goto -> bb17; +// bb3: { +// ReadForMatch(_4); +// falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2 // } -// // bb4: { -// falseEdges -> [real: bb9, imaginary: bb5]; //pre_binding1 +// ReadForMatch(_4); +// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3 // } // bb5: { -// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding2 +// ReadForMatch(_4); +// falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4 // } // bb6: { -// falseEdges -> [real: bb13, imaginary: bb7]; //pre_binding3 -// } -// bb7: { -// falseEdges -> [real: bb16, imaginary: bb8]; //pre_binding4 -// } -// bb8: { // unreachable; // } -// bb9: { // binding1: Some(w) if guard() -// StorageLive(_5); -// _5 = &((_2 as Some).0: i32); -// StorageLive(_11); -// _11 = const guard() -> [return: bb10, unwind: bb1]; +// bb7: { // binding1: Some(w) if guard() +// StorageLive(_7); +// _7 = &((_2 as Some).0: i32); +// StorageLive(_14); +// _14 = const guard() -> [return: bb8, unwind: bb1]; // } -// bb10: { //end of guard -// StorageLive(_4); -// _4 = ((_2 as Some).0: i32); -// switchInt(move _11) -> [false: bb11, otherwise: bb2]; +// bb8: { //end of guard +// switchInt(move _14) -> [false: bb9, otherwise: bb10]; // } -// bb11: { // to pre_binding2 -// falseEdges -> [real: bb5, imaginary: bb5]; +// bb9: { // to pre_binding2 +// falseEdges -> [real: bb3, imaginary: bb3]; // } -// bb12: { // binding2 & arm2 -// StorageLive(_6); -// _6 = _2; -// _1 = const 2i32; +// bb10: { // set up bindings for arm1 +// StorageLive(_5); +// _5 = ((_2 as Some).0: i32); +// _1 = const 1i32; // goto -> bb17; // } -// bb13: { // binding3: Some(y) if guard2(y) +// bb11: { // binding2 & arm2 // StorageLive(_8); -// _8 = &((_2 as Some).0: i32); -// StorageLive(_13); -// StorageLive(_14); -// _14 = (*_8); -// _13 = const guard2(move _14) -> [return: bb14, unwind: bb1]; +// _8 = _2; +// _1 = const 2i32; +// goto -> bb17; // } -// bb14: { // end of guard2 -// StorageDead(_14); -// StorageLive(_7); -// _7 = ((_2 as Some).0: i32); -// switchInt(move _13) -> [false: bb15, otherwise: bb3]; +// bb12: { // binding3: Some(y) if guard2(y) +// StorageLive(_11); +// _11 = &((_2 as Some).0: i32); +// StorageLive(_16); +// StorageLive(_17); +// _17 = (*_11); +// _16 = const guard2(move _17) -> [return: bb13, unwind: bb1]; // } -// bb15: { // to pre_binding4 -// falseEdges -> [real: bb7, imaginary: bb7]; +// bb13: { // end of guard2 +// StorageDead(_17); +// switchInt(move _16) -> [false: bb14, otherwise: bb15]; // } -// bb16: { // binding4 & arm4 +// bb14: { // to pre_binding4 +// falseEdges -> [real: bb5, imaginary: bb5]; +// } +// bb15: { // set up bindings for arm3 // StorageLive(_9); -// _9 = _2; +// _9 = ((_2 as Some).0: i32); +// _1 = const 3i32; +// goto -> bb17; +// } +// bb16: { // binding4 & arm4 +// StorageLive(_12); +// _12 = _2; // _1 = const 4i32; // goto -> bb17; // } |
