]> git.lizzy.rs Git - rust.git/blob - tests/codegen/personality_lifetimes.rs
Auto merge of #107843 - bjorn3:sync_cg_clif-2023-02-09, r=bjorn3
[rust.git] / tests / codegen / personality_lifetimes.rs
1 // ignore-msvc
2 // ignore-wasm32-bare compiled with panic=abort by default
3
4 // compile-flags: -O -C no-prepopulate-passes
5
6 #![crate_type="lib"]
7
8 struct S;
9
10 impl Drop for S {
11     fn drop(&mut self) {
12     }
13 }
14
15 fn might_unwind() {
16 }
17
18 // CHECK-LABEL: @test
19 #[no_mangle]
20 pub fn test() {
21     let _s = S;
22     // Check that the personality slot alloca gets a lifetime start in each cleanup block, not just
23     // in the first one.
24     // CHECK: [[SLOT:%[0-9]+]] = alloca { {{i8\*|ptr}}, i32 }
25     // CHECK-LABEL: cleanup:
26     // CHECK: call void @llvm.lifetime.start.{{.*}}({{.*}})
27     // CHECK-LABEL: cleanup1:
28     // CHECK: call void @llvm.lifetime.start.{{.*}}({{.*}})
29     might_unwind();
30     let _t = S;
31     might_unwind();
32 }