blob: 0b1b2526ca1cdd3a3d5c4ac62d7036c578756e03 [file] [edit]
// Regression test for preserving constant return values after a use of the
// same local through `black_box` or formatting.
//@ compile-flags: -Copt-level=3
#![crate_type = "lib"]
use std::hint::black_box;
// CHECK-LABEL: @black_box_ref_constant
#[no_mangle]
pub fn black_box_ref_constant() -> i32 {
let x = 1;
black_box(&x);
// CHECK: ret i32 1
x
}
// CHECK-LABEL: @format_ref_constant
#[no_mangle]
pub fn format_ref_constant() -> i32 {
let x = 1;
println!("{}", x);
// CHECK: ret i32 1
x
}