forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#117469 - cjgillot:filecheck-mir, r=Mark-Simul…
…acrum Add FileCheck annotations to a few MIR opt tests const_debuginfo did not specify which passes were running. const_prop_miscompile is renamed and moved to const_prop directory. while_storage was broken.
- Loading branch information
Showing
12 changed files
with
307 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY | ||
// Test that we correctly generate StorageDead statements for while loop | ||
// conditions on all branches | ||
// compile-flags: -Zmir-opt-level=0 | ||
|
||
fn get_bool(c: bool) -> bool { | ||
c | ||
} | ||
|
||
// EMIT_MIR while_storage.while_loop.PreCodegen.after.mir | ||
fn while_loop(c: bool) { | ||
// CHECK-LABEL: fn while_loop( | ||
// CHECK: bb0: { | ||
// CHECK-NEXT: goto -> bb1; | ||
// CHECK: bb1: { | ||
// CHECK-NEXT: StorageLive(_3); | ||
// CHECK-NEXT: StorageLive(_2); | ||
// CHECK-NEXT: _2 = _1; | ||
// CHECK-NEXT: _3 = get_bool(move _2) -> [return: bb2, unwind | ||
// CHECK: bb2: { | ||
// CHECK-NEXT: switchInt(move _3) -> [0: bb3, otherwise: bb4]; | ||
// CHECK: bb3: { | ||
// CHECK-NEXT: StorageDead(_2); | ||
// CHECK-NEXT: StorageLive(_9); | ||
// CHECK-NEXT: _0 = const (); | ||
// CHECK-NEXT: StorageDead(_9); | ||
// CHECK-NEXT: goto -> bb8; | ||
// CHECK: bb4: { | ||
// CHECK-NEXT: StorageDead(_2); | ||
// CHECK-NEXT: StorageLive(_5); | ||
// CHECK-NEXT: StorageLive(_4); | ||
// CHECK-NEXT: _4 = _1; | ||
// CHECK-NEXT: _5 = get_bool(move _4) -> [return: bb5, unwind | ||
// CHECK: bb5: { | ||
// CHECK-NEXT: switchInt(move _5) -> [0: bb6, otherwise: bb7]; | ||
// CHECK: bb6: { | ||
// CHECK-NEXT: StorageDead(_4); | ||
// CHECK-NEXT: _6 = const (); | ||
// CHECK-NEXT: StorageDead(_5); | ||
// CHECK-NEXT: StorageDead(_3); | ||
// CHECK-NEXT: goto -> bb1; | ||
// CHECK: bb7: { | ||
// CHECK-NEXT: StorageDead(_4); | ||
// CHECK-NEXT: _0 = const (); | ||
// CHECK-NEXT: StorageDead(_5); | ||
// CHECK-NEXT: goto -> bb8; | ||
// CHECK: bb8: { | ||
// CHECK-NEXT: StorageDead(_3); | ||
// CHECK-NEXT: return; | ||
|
||
while get_bool(c) { | ||
if get_bool(c) { | ||
break; | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
while_loop(false); | ||
} |
70 changes: 70 additions & 0 deletions
70
tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-abort.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// MIR for `while_loop` after PreCodegen | ||
|
||
fn while_loop(_1: bool) -> () { | ||
debug c => _1; | ||
let mut _0: (); | ||
let mut _2: bool; | ||
let mut _3: bool; | ||
let mut _4: bool; | ||
let mut _5: bool; | ||
let mut _6: (); | ||
let mut _7: !; | ||
let mut _8: !; | ||
let _9: (); | ||
let mut _10: !; | ||
|
||
bb0: { | ||
goto -> bb1; | ||
} | ||
|
||
bb1: { | ||
StorageLive(_3); | ||
StorageLive(_2); | ||
_2 = _1; | ||
_3 = get_bool(move _2) -> [return: bb2, unwind unreachable]; | ||
} | ||
|
||
bb2: { | ||
switchInt(move _3) -> [0: bb3, otherwise: bb4]; | ||
} | ||
|
||
bb3: { | ||
StorageDead(_2); | ||
StorageLive(_9); | ||
_0 = const (); | ||
StorageDead(_9); | ||
goto -> bb8; | ||
} | ||
|
||
bb4: { | ||
StorageDead(_2); | ||
StorageLive(_5); | ||
StorageLive(_4); | ||
_4 = _1; | ||
_5 = get_bool(move _4) -> [return: bb5, unwind unreachable]; | ||
} | ||
|
||
bb5: { | ||
switchInt(move _5) -> [0: bb6, otherwise: bb7]; | ||
} | ||
|
||
bb6: { | ||
StorageDead(_4); | ||
_6 = const (); | ||
StorageDead(_5); | ||
StorageDead(_3); | ||
goto -> bb1; | ||
} | ||
|
||
bb7: { | ||
StorageDead(_4); | ||
_0 = const (); | ||
StorageDead(_5); | ||
goto -> bb8; | ||
} | ||
|
||
bb8: { | ||
StorageDead(_3); | ||
return; | ||
} | ||
} |
70 changes: 70 additions & 0 deletions
70
tests/mir-opt/building/while_storage.while_loop.PreCodegen.after.panic-unwind.mir
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// MIR for `while_loop` after PreCodegen | ||
|
||
fn while_loop(_1: bool) -> () { | ||
debug c => _1; | ||
let mut _0: (); | ||
let mut _2: bool; | ||
let mut _3: bool; | ||
let mut _4: bool; | ||
let mut _5: bool; | ||
let mut _6: (); | ||
let mut _7: !; | ||
let mut _8: !; | ||
let _9: (); | ||
let mut _10: !; | ||
|
||
bb0: { | ||
goto -> bb1; | ||
} | ||
|
||
bb1: { | ||
StorageLive(_3); | ||
StorageLive(_2); | ||
_2 = _1; | ||
_3 = get_bool(move _2) -> [return: bb2, unwind continue]; | ||
} | ||
|
||
bb2: { | ||
switchInt(move _3) -> [0: bb3, otherwise: bb4]; | ||
} | ||
|
||
bb3: { | ||
StorageDead(_2); | ||
StorageLive(_9); | ||
_0 = const (); | ||
StorageDead(_9); | ||
goto -> bb8; | ||
} | ||
|
||
bb4: { | ||
StorageDead(_2); | ||
StorageLive(_5); | ||
StorageLive(_4); | ||
_4 = _1; | ||
_5 = get_bool(move _4) -> [return: bb5, unwind continue]; | ||
} | ||
|
||
bb5: { | ||
switchInt(move _5) -> [0: bb6, otherwise: bb7]; | ||
} | ||
|
||
bb6: { | ||
StorageDead(_4); | ||
_6 = const (); | ||
StorageDead(_5); | ||
StorageDead(_3); | ||
goto -> bb1; | ||
} | ||
|
||
bb7: { | ||
StorageDead(_4); | ||
_0 = const (); | ||
StorageDead(_5); | ||
goto -> bb8; | ||
} | ||
|
||
bb8: { | ||
StorageDead(_3); | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.