-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try enabling MatchBranchSimplification
- Loading branch information
Showing
5 changed files
with
50 additions
and
7 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
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
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,21 @@ | ||
// Test that MatchBranchSimplification doesn't ICE on a SwitchInt where | ||
// one of the targets is the block that the SwitchInt terminates. | ||
#![crate_type = "lib"] | ||
#![feature(core_intrinsics, custom_mir)] | ||
use std::intrinsics::mir::*; | ||
|
||
// EMIT_MIR switch_to_self.test.MatchBranchSimplification.diff | ||
#[custom_mir(dialect = "runtime", phase = "post-cleanup")] | ||
pub fn test(x: bool) { | ||
mir!( | ||
{ | ||
Goto(bb0) | ||
} | ||
bb0 = { | ||
match x { false => bb0, _ => bb1 } | ||
} | ||
bb1 = { | ||
match x { false => bb0, _ => bb1 } | ||
} | ||
) | ||
} |
19 changes: 19 additions & 0 deletions
19
tests/mir-opt/switch_to_self.test.MatchBranchSimplification.diff
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,19 @@ | ||
- // MIR for `test` before MatchBranchSimplification | ||
+ // MIR for `test` after MatchBranchSimplification | ||
|
||
fn test(_1: bool) -> () { | ||
let mut _0: (); // return place in scope 0 at $DIR/switch_to_self.rs:+0:22: +0:22 | ||
|
||
bb0: { | ||
goto -> bb1; // scope 0 at $DIR/switch_to_self.rs:+3:13: +3:22 | ||
} | ||
|
||
bb1: { | ||
switchInt(_1) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/switch_to_self.rs:+6:13: +6:47 | ||
} | ||
|
||
bb2: { | ||
switchInt(_1) -> [0: bb1, otherwise: bb2]; // scope 0 at $DIR/switch_to_self.rs:+9:13: +9:47 | ||
} | ||
} | ||
|