1 // Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
11 // compile-flags: -O -C no-prepopulate-passes
13 #![crate_type = "lib"]
14 #![feature(rustc_attrs)]
18 #[rustc_mir] // FIXME #27840 MIR has different codegen.
21 &a; // keep variable in an alloca
23 // CHECK: [[S_a:%[0-9]+]] = bitcast i32* %a to i8*
24 // CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S_a]])
28 &b; // keep variable in an alloca
30 // CHECK: [[S_b:%[0-9]+]] = bitcast %"core::option::Option<i32>"** %b to i8*
31 // CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S_b]])
33 // CHECK: [[S__5:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_5 to i8*
34 // CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S__5]])
36 // CHECK: [[E__5:%[0-9]+]] = bitcast %"core::option::Option<i32>"* %_5 to i8*
37 // CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E__5]])
39 // CHECK: [[E_b:%[0-9]+]] = bitcast %"core::option::Option<i32>"** %b to i8*
40 // CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E_b]])
44 &c; // keep variable in an alloca
46 // CHECK: [[S_c:%[0-9]+]] = bitcast i32* %c to i8*
47 // CHECK: call void @llvm.lifetime.start(i{{[0-9 ]+}}, i8* [[S_c]])
49 // CHECK: [[E_c:%[0-9]+]] = bitcast i32* %c to i8*
50 // CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E_c]])
52 // CHECK: [[E_a:%[0-9]+]] = bitcast i32* %a to i8*
53 // CHECK: call void @llvm.lifetime.end(i{{[0-9 ]+}}, i8* [[E_a]])