2022-10-07 12:59:26 +01:00
|
|
|
// Tests inlining of `may_unwind` inline assembly.
|
|
|
|
//
|
2023-06-08 09:18:34 +02:00
|
|
|
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
|
2022-10-07 18:01:17 +01:00
|
|
|
//@ needs-asm-support
|
2023-10-22 09:27:43 -07:00
|
|
|
//@ needs-unwind
|
2024-04-14 18:22:35 -07:00
|
|
|
//@ compile-flags: -Zinline-mir-hint-threshold=1000 -C debuginfo=full
|
2022-10-07 12:59:26 +01:00
|
|
|
#![feature(asm_unwind)]
|
|
|
|
|
|
|
|
struct D;
|
|
|
|
|
|
|
|
impl Drop for D {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
2023-06-04 20:21:00 -04:00
|
|
|
#[inline]
|
2022-10-07 12:59:26 +01:00
|
|
|
fn foo() {
|
|
|
|
let _d = D;
|
|
|
|
unsafe { std::arch::asm!("", options(may_unwind)) };
|
|
|
|
}
|
|
|
|
|
|
|
|
// EMIT_MIR asm_unwind.main.Inline.diff
|
|
|
|
pub fn main() {
|
2023-10-20 11:10:30 -07:00
|
|
|
// CHECK-LABEL: fn main(
|
|
|
|
// CHECK: (inlined foo)
|
2023-10-22 09:27:43 -07:00
|
|
|
// CHECK: asm!("", options(MAY_UNWIND)) -> [return: {{bb.*}}, unwind: [[unwind:bb.*]]];
|
|
|
|
// CHECK: [[unwind]] (cleanup)
|
2022-10-07 12:59:26 +01:00
|
|
|
foo();
|
|
|
|
}
|