Skip to content

Commit

Permalink
emit diff after SimplifyBranches-after-copy-prop
Browse files Browse the repository at this point in the history
  • Loading branch information
simonvandel committed Sep 20, 2020
1 parent e25738f commit 0363694
Show file tree
Hide file tree
Showing 3 changed files with 480 additions and 168 deletions.
10 changes: 6 additions & 4 deletions src/test/mir-opt/early_otherwise_branch_68867.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// ignore-tidy-linelength
// compile-flags: -Z mir-opt-level=3

// example from #68867
Expand All @@ -11,10 +12,12 @@ pub enum ViewportPercentageLength {
}

// EMIT_MIR early_otherwise_branch_68867.try_sum.EarlyOtherwiseBranch.diff
// EMIT_MIR early_otherwise_branch_68867.try_sum EarlyOtherwiseBranch.before SimplifyBranches-after-copy-prop.after
#[no_mangle]
pub extern "C" fn try_sum(x: &ViewportPercentageLength,
other: &ViewportPercentageLength)
-> Result<ViewportPercentageLength, ()> {
pub extern "C" fn try_sum(
x: &ViewportPercentageLength,
other: &ViewportPercentageLength,
) -> Result<ViewportPercentageLength, ()> {
use self::ViewportPercentageLength::*;
Ok(match (x, other) {
(&Vw(one), &Vw(other)) => Vw(one + other),
Expand All @@ -25,7 +28,6 @@ pub extern "C" fn try_sum(x: &ViewportPercentageLength,
})
}


fn main() {
try_sum(&ViewportPercentageLength::Vw(1.0), &ViewportPercentageLength::Vw(2.0));
}
Loading

0 comments on commit 0363694

Please sign in to comment.