1
Fork 0

Update mir opt tests

This commit is contained in:
Matthew Jasper 2018-09-15 11:18:45 +01:00
parent f71f733d48
commit 531e98a0d8
6 changed files with 88 additions and 81 deletions

View file

@ -63,7 +63,6 @@ impl Drop for S {
// //
// bb4: { // bb4: {
// StorageDead(_2); // StorageDead(_2);
// FakeRead(ForLet, _1);
// StorageLive(_4); // StorageLive(_4);
// _4 = move _1; // _4 = move _1;
// _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7]; // _3 = const std::mem::drop(move _4) -> [return: bb5, unwind: bb7];

View file

@ -34,10 +34,9 @@ fn main() {
// } // }
// let mut _1: (); // let mut _1: ();
// let mut _3: bool; // let mut _3: bool;
// let mut _4: u8; // let mut _4: !;
// let mut _5: !; // let mut _5: ();
// let mut _6: (); // let mut _6: &i32;
// let mut _7: &i32;
// bb0: { // bb0: {
// goto -> bb1; // goto -> bb1;
// } // }
@ -51,7 +50,7 @@ fn main() {
// StorageLive(_2); // StorageLive(_2);
// StorageLive(_3); // StorageLive(_3);
// _3 = const true; // _3 = const true;
// _4 = discriminant(_3); // FakeRead(ForMatchedPlace, _3);
// switchInt(_3) -> [false: bb11, otherwise: bb10]; // switchInt(_3) -> [false: bb11, otherwise: bb10];
// } // }
// bb4: { // bb4: {
@ -89,9 +88,9 @@ fn main() {
// bb14: { // bb14: {
// FakeRead(ForLet, _2); // FakeRead(ForLet, _2);
// StorageDead(_3); // StorageDead(_3);
// StorageLive(_7); // StorageLive(_6);
// _7 = &_2; // _6 = &_2;
// _6 = const std::mem::drop(move _7) -> [return: bb28, unwind: bb4]; // _5 = const std::mem::drop(move _6) -> [return: bb28, unwind: bb4];
// } // }
// bb15: { // bb15: {
// goto -> bb16; // goto -> bb16;
@ -129,15 +128,15 @@ fn main() {
// goto -> bb2; // goto -> bb2;
// } // }
// bb26: { // bb26: {
// _5 = (); // _4 = ();
// unreachable; // unreachable;
// } // }
// bb27: { // bb27: {
// StorageDead(_5); // StorageDead(_4);
// goto -> bb14; // goto -> bb14;
// } // }
// bb28: { // bb28: {
// StorageDead(_7); // StorageDead(_6);
// _1 = (); // _1 = ();
// StorageDead(_2); // StorageDead(_2);
// goto -> bb1; // goto -> bb1;

View file

@ -53,10 +53,11 @@ fn main() {
// bb0: { // bb0: {
// ... // ...
// _2 = std::option::Option<i32>::Some(const 42i32,); // _2 = std::option::Option<i32>::Some(const 42i32,);
// _3 = discriminant(_2); // FakeRead(ForMatchedPlace, _2);
// _4 = &(promoted[1]: std::option::Option<i32>); // _7 = discriminant(_2);
// _9 = discriminant(_2); // _9 = &shallow (promoted[2]: std::option::Option<i32>);
// switchInt(move _9) -> [0isize: bb5, 1isize: bb3, otherwise: bb7]; // _10 = &(((promoted[1]: std::option::Option<i32>) as Some).0: i32);
// switchInt(move _7) -> [0isize: bb5, 1isize: bb3, otherwise: bb7];
// } // }
// bb1: { // bb1: {
// resume; // resume;
@ -66,15 +67,18 @@ fn main() {
// goto -> bb13; // goto -> bb13;
// } // }
// bb3: { // binding3(empty) and arm3 // bb3: { // binding3(empty) and arm3
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 // falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
// } // }
// bb4: { // bb4: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2 // falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding2
// } // }
// bb5: { // bb5: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3 // falseEdges -> [real: bb2, imaginary: bb6]; //pre_binding3
// } // }
// bb6: { // bb6: {
@ -84,31 +88,31 @@ fn main() {
// unreachable; // unreachable;
// } // }
// bb8: { // binding1 and guard // bb8: { // binding1 and guard
// StorageLive(_7); // StorageLive(_5);
// _7 = &(((promoted[0]: std::option::Option<i32>) as Some).0: i32); // _5 = &(((promoted[0]: std::option::Option<i32>) as Some).0: i32);
// StorageLive(_10); // StorageLive(_8);
// _10 = const guard() -> [return: bb9, unwind: bb1]; // _8 = const guard() -> [return: bb9, unwind: bb1];
// } // }
// bb9: { // bb9: {
// switchInt(move _10) -> [false: bb10, otherwise: bb11]; // switchInt(move _8) -> [false: bb10, otherwise: bb11];
// } // }
// bb10: { // to pre_binding2 // bb10: { // to pre_binding2
// falseEdges -> [real: bb4, imaginary: bb4]; // falseEdges -> [real: bb4, imaginary: bb4];
// } // }
// bb11: { // bindingNoLandingPads.before.mir2 and arm2 // bb11: { // bindingNoLandingPads.before.mir2 and arm2
// StorageLive(_5); // StorageLive(_3);
// _5 = ((_2 as Some).0: i32); // _3 = ((_2 as Some).0: i32);
// StorageLive(_11); // StorageLive(_11);
// _11 = _5; // _11 = _3;
// _1 = (const 1i32, move _11); // _1 = (const 1i32, move _11);
// StorageDead(_11); // StorageDead(_11);
// goto -> bb13; // goto -> bb13;
// } // }
// bb12: { // bb12: {
// StorageLive(_8); // StorageLive(_6);
// _8 = ((_2 as Some).0: i32); // _6 = ((_2 as Some).0: i32);
// StorageLive(_12); // StorageLive(_12);
// _12 = _8; // _12 = _6;
// _1 = (const 2i32, move_12); // _1 = (const 2i32, move_12);
// StorageDead(_12); // StorageDead(_12);
// goto -> bb13; // goto -> bb13;
@ -123,10 +127,11 @@ fn main() {
// bb0: { // bb0: {
// ... // ...
// _2 = std::option::Option<i32>::Some(const 42i32,); // _2 = std::option::Option<i32>::Some(const 42i32,);
// _3 = discriminant(_2); // FakeRead(ForMatchedPlace, _2);
// _4 = &_2; // _7 = discriminant(_2);
// _9 = discriminant(_2); // _9 = &shallow _2;
// switchInt(move _9) -> [0isize: bb4, 1isize: bb3, otherwise: bb7]; // _10 = &((_2 as Some).0: i32);
// switchInt(move _7) -> [0isize: bb4, 1isize: bb3, otherwise: bb7];
// } // }
// bb1: { // bb1: {
// resume; // resume;
@ -136,15 +141,18 @@ fn main() {
// goto -> bb13; // goto -> bb13;
// } // }
// bb3: { // bb3: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1 // falseEdges -> [real: bb8, imaginary: bb4]; //pre_binding1
// } // }
// bb4: { // bb4: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2 // falseEdges -> [real: bb2, imaginary: bb5]; //pre_binding2
// } // }
// bb5: { // bb5: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _9);
// FakeRead(ForMatchGuard, _10);
// falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3 // falseEdges -> [real: bb12, imaginary: bb6]; //pre_binding3
// } // }
// bb6: { // bb6: {
@ -154,31 +162,31 @@ fn main() {
// unreachable; // unreachable;
// } // }
// bb8: { // binding1 and guard // bb8: { // binding1 and guard
// StorageLive(_7); // StorageLive(_5);
// _7 = &((_2 as Some).0: i32); // _5 = &((_2 as Some).0: i32);
// StorageLive(_10); // StorageLive(_8);
// _10 = const guard() -> [return: bb9, unwind: bb1]; // _8 = const guard() -> [return: bb9, unwind: bb1];
// } // }
// bb9: { // end of guard // bb9: { // end of guard
// switchInt(move _10) -> [false: bb10, otherwise: bb11]; // switchInt(move _8) -> [false: bb10, otherwise: bb11];
// } // }
// bb10: { // to pre_binding3 (can skip 2 since this is `Some`) // bb10: { // to pre_binding3 (can skip 2 since this is `Some`)
// falseEdges -> [real: bb5, imaginary: bb4]; // falseEdges -> [real: bb5, imaginary: bb4];
// } // }
// bb11: { // arm1 // bb11: { // arm1
// StorageLive(_5); // StorageLive(_3);
// _5 = ((_2 as Some).0: i32); // _3 = ((_2 as Some).0: i32);
// StorageLive(_11); // StorageLive(_11);
// _11 = _5; // _11 = _3;
// _1 = (const 1i32, move _11); // _1 = (const 1i32, move _11);
// StorageDead(_11); // StorageDead(_11);
// goto -> bb13; // goto -> bb13;
// } // }
// bb12: { // binding3 and arm3 // bb12: { // binding3 and arm3
// StorageLive(_8); // StorageLive(_6);
// _8 = ((_2 as Some).0: i32); // _6 = ((_2 as Some).0: i32);
// StorageLive(_12); // StorageLive(_12);
// _12 = _8; // _12 = _6;
// _1 = (const 2i32, move _12); // _1 = (const 2i32, move _12);
// StorageDead(_12); // StorageDead(_12);
// goto -> bb13; // goto -> bb13;
@ -193,81 +201,86 @@ fn main() {
// bb0: { // bb0: {
// ... // ...
// _2 = std::option::Option<i32>::Some(const 1i32,); // _2 = std::option::Option<i32>::Some(const 1i32,);
// _3 = discriminant(_2); // FakeRead(ForMatchedPlace, _2);
// _4 = &_2; // _11 = discriminant(_2);
// _13 = discriminant(_2); // _16 = &shallow _2;
// switchInt(move _13) -> [1isize: bb2, otherwise: bb3]; // _17 = &((_2 as Some).0: i32);
// switchInt(move _11) -> [1isize: bb2, otherwise: bb3];
// } // }
// bb1: { // bb1: {
// resume; // resume;
// } // }
// bb2: { // bb2: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _16);
// FakeRead(ForMatchGuard, _17);
// falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1 // falseEdges -> [real: bb7, imaginary: bb3]; //pre_binding1
// } // }
// bb3: { // bb3: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _16);
// FakeRead(ForMatchGuard, _17);
// falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2 // falseEdges -> [real: bb11, imaginary: bb4]; //pre_binding2
// } // }
// bb4: { // bb4: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _16);
// FakeRead(ForMatchGuard, _17);
// falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3 // falseEdges -> [real: bb12, imaginary: bb5]; //pre_binding3
// } // }
// bb5: { // bb5: {
// FakeRead(ForMatch, _4); // FakeRead(ForMatchGuard, _16);
// FakeRead(ForMatchGuard, _17);
// falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4 // falseEdges -> [real: bb16, imaginary: bb6]; //pre_binding4
// } // }
// bb6: { // bb6: {
// unreachable; // unreachable;
// } // }
// bb7: { // binding1: Some(w) if guard() // bb7: { // binding1: Some(w) if guard()
// StorageLive(_7); // StorageLive(_5);
// _7 = &((_2 as Some).0: i32); // _5 = &((_2 as Some).0: i32);
// StorageLive(_14); // StorageLive(_12);
// _14 = const guard() -> [return: bb8, unwind: bb1]; // _12 = const guard() -> [return: bb8, unwind: bb1];
// } // }
// bb8: { //end of guard // bb8: { //end of guard
// switchInt(move _14) -> [false: bb9, otherwise: bb10]; // switchInt(move _12) -> [false: bb9, otherwise: bb10];
// } // }
// bb9: { // to pre_binding2 // bb9: { // to pre_binding2
// falseEdges -> [real: bb3, imaginary: bb3]; // falseEdges -> [real: bb3, imaginary: bb3];
// } // }
// bb10: { // set up bindings for arm1 // bb10: { // set up bindings for arm1
// StorageLive(_5); // StorageLive(_3);
// _5 = ((_2 as Some).0: i32); // _3 = ((_2 as Some).0: i32);
// _1 = const 1i32; // _1 = const 1i32;
// goto -> bb17; // goto -> bb17;
// } // }
// bb11: { // binding2 & arm2 // bb11: { // binding2 & arm2
// StorageLive(_8); // StorageLive(_6);
// _8 = _2; // _6 = _2;
// _1 = const 2i32; // _1 = const 2i32;
// goto -> bb17; // goto -> bb17;
// } // }
// bb12: { // binding3: Some(y) if guard2(y) // bb12: { // binding3: Some(y) if guard2(y)
// StorageLive(_11); // StorageLive(_9);
// _11 = &((_2 as Some).0: i32); // _9 = &((_2 as Some).0: i32);
// StorageLive(_16); // StorageLive(_14);
// StorageLive(_17); // StorageLive(_15);
// _17 = (*_11); // _15 = (*_9);
// _16 = const guard2(move _17) -> [return: bb13, unwind: bb1]; // _14 = const guard2(move _15) -> [return: bb13, unwind: bb1];
// } // }
// bb13: { // end of guard2 // bb13: { // end of guard2
// StorageDead(_17); // StorageDead(_15);
// switchInt(move _16) -> [false: bb14, otherwise: bb15]; // switchInt(move _14) -> [false: bb14, otherwise: bb15];
// } // }
// bb14: { // to pre_binding4 // bb14: { // to pre_binding4
// falseEdges -> [real: bb5, imaginary: bb5]; // falseEdges -> [real: bb5, imaginary: bb5];
// } // }
// bb15: { // set up bindings for arm3 // bb15: { // set up bindings for arm3
// StorageLive(_9); // StorageLive(_7);
// _9 = ((_2 as Some).0: i32); // _7 = ((_2 as Some).0: i32);
// _1 = const 3i32; // _1 = const 3i32;
// goto -> bb17; // goto -> bb17;
// } // }
// bb16: { // binding4 & arm4 // bb16: { // binding4 & arm4
// StorageLive(_12); // StorageLive(_10);
// _12 = _2; // _10 = _2;
// _1 = const 4i32; // _1 = const 4i32;
// goto -> bb17; // goto -> bb17;
// } // }

View file

@ -67,7 +67,6 @@ fn main() {
// Validate(Suspend(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 })), [(*_2): i32]); // Validate(Suspend(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 })), [(*_2): i32]);
// _3 = &ReErased (*_2); // _3 = &ReErased (*_2);
// Validate(Acquire, [(*_3): i32/ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 }) (imm)]); // Validate(Acquire, [(*_3): i32/ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 }) (imm)]);
// FakeRead(ForLet, _3);
// _0 = (*_3); // _0 = (*_3);
// EndRegion(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 })); // EndRegion(ReScope(Remainder { block: ItemLocalId(25), first_statement_index: 0 }));
// StorageDead(_3); // StorageDead(_3);

View file

@ -28,7 +28,6 @@ fn main() {
// Validate(Acquire, [_1: std::boxed::Box<[i32]>]); // Validate(Acquire, [_1: std::boxed::Box<[i32]>]);
// StorageDead(_2); // StorageDead(_2);
// StorageDead(_3); // StorageDead(_3);
// FakeRead(ForLet, _1);
// _0 = (); // _0 = ();
// Validate(Release, [_1: std::boxed::Box<[i32]>]); // Validate(Release, [_1: std::boxed::Box<[i32]>]);
// drop(_1) -> [return: bb2, unwind: bb3]; // drop(_1) -> [return: bb2, unwind: bb3];

View file

@ -47,12 +47,10 @@ fn main() {
// bb0: { // bb0: {
// StorageLive(_1); // StorageLive(_1);
// _1 = Test { x: const 0i32 }; // _1 = Test { x: const 0i32 };
// FakeRead(ForLet, _1);
// StorageLive(_2); // StorageLive(_2);
// Validate(Suspend(ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 })), [_1: Test]); // Validate(Suspend(ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 })), [_1: Test]);
// _2 = &ReErased _1; // _2 = &ReErased _1;
// Validate(Acquire, [(*_2): Test/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]); // Validate(Acquire, [(*_2): Test/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]);
// FakeRead(ForLet, _2);
// StorageLive(_4); // StorageLive(_4);
// StorageLive(_5); // StorageLive(_5);
// Validate(Suspend(ReScope(Node(ItemLocalId(18)))), [((*_2).0: i32): i32/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]); // Validate(Suspend(ReScope(Node(ItemLocalId(18)))), [((*_2).0: i32): i32/ReScope(Remainder { block: ItemLocalId(20), first_statement_index: 3 }) (imm)]);