2020-10-16 19:00:00 -05:00
|
|
|
//@ compile-flags: -O -C no-prepopulate-passes -Zmir-opt-level=0
|
2016-08-13 22:34:14 -05:00
|
|
|
|
|
|
|
#![crate_type = "lib"]
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn test() {
|
2022-02-21 04:21:23 -06:00
|
|
|
let a = 0u8;
|
2016-08-13 22:34:14 -05:00
|
|
|
&a; // keep variable in an alloca
|
|
|
|
|
2023-07-27 16:44:13 -05:00
|
|
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
2016-08-13 22:34:14 -05:00
|
|
|
|
|
|
|
{
|
|
|
|
let b = &Some(a);
|
|
|
|
&b; // keep variable in an alloca
|
|
|
|
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
2016-08-13 22:34:14 -05:00
|
|
|
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
2016-08-13 22:34:14 -05:00
|
|
|
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
2018-07-03 20:09:00 -05:00
|
|
|
|
2022-02-21 04:21:23 -06:00
|
|
|
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, {{.*}})
|
2016-08-13 22:34:14 -05:00
|
|
|
}
|
|
|
|
|
2022-02-21 04:21:23 -06:00
|
|
|
let c = 1u8;
|
2016-08-13 22:34:14 -05:00
|
|
|
&c; // keep variable in an alloca
|
|
|
|
|
2023-07-27 16:44:13 -05:00
|
|
|
// CHECK: call void @llvm.lifetime.start{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
2016-08-13 22:34:14 -05:00
|
|
|
|
2023-07-27 16:44:13 -05:00
|
|
|
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %c)
|
2016-08-13 22:34:14 -05:00
|
|
|
|
2023-07-27 16:44:13 -05:00
|
|
|
// CHECK: call void @llvm.lifetime.end{{.*}}(i{{[0-9 ]+}}, ptr %a)
|
2016-08-13 22:34:14 -05:00
|
|
|
}
|