forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
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#131244 - clubby789:match-branches-unreachable…
…, r=DianQK Consider empty-unreachable otherwise branches in MatchBranchSimplification Fixes rust-lang#131219
- Loading branch information
Showing
7 changed files
with
108 additions
and
29 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
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
37 changes: 37 additions & 0 deletions
37
tests/mir-opt/matches_reduce_branches.my_is_some.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,37 @@ | ||
- // MIR for `my_is_some` before MatchBranchSimplification | ||
+ // MIR for `my_is_some` after MatchBranchSimplification | ||
|
||
fn my_is_some(_1: Option<()>) -> bool { | ||
debug bar => _1; | ||
let mut _0: bool; | ||
let mut _2: isize; | ||
+ let mut _3: isize; | ||
|
||
bb0: { | ||
_2 = discriminant(_1); | ||
- switchInt(move _2) -> [0: bb2, 1: bb3, otherwise: bb1]; | ||
- } | ||
- | ||
- bb1: { | ||
- unreachable; | ||
- } | ||
- | ||
- bb2: { | ||
- _0 = const false; | ||
- goto -> bb4; | ||
- } | ||
- | ||
- bb3: { | ||
- _0 = const true; | ||
- goto -> bb4; | ||
- } | ||
- | ||
- bb4: { | ||
+ StorageLive(_3); | ||
+ _3 = move _2; | ||
+ _0 = Ne(copy _3, const 0_isize); | ||
+ 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