]> git.lizzy.rs Git - rust.git/blob - src/test/codegen/personality_lifetimes.rs
Rollup merge of #65389 - ecstatic-morse:zero-sized-array-no-drop, r=eddyb
[rust.git] / src / test / codegen / personality_lifetimes.rs
1 // ignore-msvc
2
3 // compile-flags: -O -C no-prepopulate-passes
4
5 #![crate_type="lib"]
6
7 struct S;
8
9 impl Drop for S {
10     fn drop(&mut self) {
11     }
12 }
13
14 fn might_unwind() {
15 }
16
17 // CHECK-LABEL: @test
18 #[no_mangle]
19 pub fn test() {
20     let _s = S;
21     // Check that the personality slot alloca gets a lifetime start in each cleanup block, not just
22     // in the first one.
23     // CHECK: [[SLOT:%[0-9]+]] = alloca { i8*, i32 }
24     // CHECK-LABEL: cleanup:
25     // CHECK: [[BITCAST:%[0-9]+]] = bitcast { i8*, i32 }* [[SLOT]] to i8*
26     // CHECK-NEXT: call void @llvm.lifetime.start.{{.*}}({{.*}}, i8* [[BITCAST]])
27     // CHECK-LABEL: cleanup1:
28     // CHECK: [[BITCAST1:%[0-9]+]] = bitcast { i8*, i32 }* [[SLOT]] to i8*
29     // CHECK-NEXT: call void @llvm.lifetime.start.{{.*}}({{.*}}, i8* [[BITCAST1]])
30     might_unwind();
31     let _t = S;
32     might_unwind();
33 }