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