-
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 #77549 - tmiasko:simplify-branch-same-fix, r=oli-obk
Fix miscompile in SimplifyBranchSame Cherry-picked from #77486, but with a different test case that used to be compiled incorrectly on both master & beta branches.
- Loading branch information
Showing
2 changed files
with
23 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Regression test for SimplifyBranchSame miscompilation. | ||
// run-pass | ||
|
||
macro_rules! m { | ||
($a:expr, $b:expr, $c:block) => { | ||
match $a { | ||
Lto::Fat | Lto::Thin => { $b; (); $c } | ||
Lto::No => { $b; () } | ||
} | ||
} | ||
} | ||
|
||
pub enum Lto { No, Thin, Fat } | ||
|
||
fn f(mut cookie: u32, lto: Lto) -> u32 { | ||
let mut _a = false; | ||
m!(lto, _a = true, {cookie = 0}); | ||
cookie | ||
} | ||
|
||
fn main() { assert_eq!(f(42, Lto::Thin), 0) } |