rust/src/test/codegen/try_identity.rs
Wesley Wiser f9d7720be7 Disable the SimplifyArmIdentity mir-opt
The optimization still has some bugs that need to be worked out
such as #77359.

We can try re-enabling this again after the known issues are resolved.
2020-10-01 20:29:53 -04:00

17 lines
442 B
Rust

// compile-flags: -C no-prepopulate-passes -Z mir-opt-level=2 -Zunsound-mir-opts
// Ensure that `x?` has no overhead on `Result<T, E>` due to identity `match`es in lowering.
// This requires inlining to trigger the MIR optimizations in `SimplifyArmIdentity`.
#![crate_type = "lib"]
type R = Result<u64, i32>;
#[no_mangle]
fn try_identity(x: R) -> R {
// CHECK: start:
// CHECK-NOT: br {{.*}}
// CHECK ret void
let y = x?;
Ok(y)
}