-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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 #131244 - clubby789:match-branches-unreachable, r=<try>
Consider empty-unreachable otherwise branches in MatchBranchSimplification Fixes #131219
- Loading branch information
Showing
7 changed files
with
130 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
36 changes: 36 additions & 0 deletions
36
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,36 @@ | ||
- // MIR for `my_is_some` before MatchBranchSimplification | ||
+ // MIR for `my_is_some` after MatchBranchSimplification | ||
|
||
fn my_is_some(_1: Option<T>) -> bool { | ||
let mut _0: bool; | ||
let mut _2: isize; | ||
+ let mut _3: isize; | ||
|
||
bb0: { | ||
_2 = discriminant(_1); | ||
- switchInt(copy _2) -> [0: bb1, 1: bb2, otherwise: bb3]; | ||
- } | ||
- | ||
- bb1: { | ||
- _0 = const false; | ||
- goto -> bb4; | ||
- } | ||
- | ||
- bb2: { | ||
- _0 = const true; | ||
- goto -> bb4; | ||
- } | ||
- | ||
- bb3: { | ||
- unreachable; | ||
- } | ||
- | ||
- bb4: { | ||
+ StorageLive(_3); | ||
+ _3 = copy _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