2017-03-31 18:09:37 +00:00
|
|
|
// ignore-msvc
|
2019-10-18 21:47:54 +00:00
|
|
|
// ignore-wasm32-bare compiled with panic=abort by default
|
2023-05-23 13:20:57 +00:00
|
|
|
// needs-unwind
|
2017-03-31 18:09:37 +00:00
|
|
|
|
2017-03-29 18:43:01 +00:00
|
|
|
// compile-flags: -O -C no-prepopulate-passes
|
|
|
|
|
|
|
|
#![crate_type="lib"]
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
impl Drop for S {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn might_unwind() {
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK-LABEL: @test
|
|
|
|
#[no_mangle]
|
|
|
|
pub fn test() {
|
|
|
|
let _s = S;
|
|
|
|
// Check that the personality slot alloca gets a lifetime start in each cleanup block, not just
|
|
|
|
// in the first one.
|
2022-02-21 10:21:23 +00:00
|
|
|
// CHECK: [[SLOT:%[0-9]+]] = alloca { {{i8\*|ptr}}, i32 }
|
2017-03-29 18:43:01 +00:00
|
|
|
// CHECK-LABEL: cleanup:
|
2022-02-21 10:21:23 +00:00
|
|
|
// CHECK: call void @llvm.lifetime.start.{{.*}}({{.*}})
|
2017-03-29 18:43:01 +00:00
|
|
|
// CHECK-LABEL: cleanup1:
|
2022-02-21 10:21:23 +00:00
|
|
|
// CHECK: call void @llvm.lifetime.start.{{.*}}({{.*}})
|
2017-03-29 18:43:01 +00:00
|
|
|
might_unwind();
|
2017-04-19 22:20:50 +00:00
|
|
|
let _t = S;
|
2017-03-29 18:43:01 +00:00
|
|
|
might_unwind();
|
|
|
|
}
|