summaryrefslogtreecommitdiffstats
path: root/tests/mir-opt/inline/asm_unwind.rs
blob: 0ae20e52211100370b2fd96d0ce815e5d017912e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Tests inlining of `may_unwind` inline assembly.
//
// EMIT_MIR_FOR_EACH_PANIC_STRATEGY
// needs-asm-support
// needs-unwind
// compile-flags: -Zinline-mir-hint-threshold=1000
#![feature(asm_unwind)]

struct D;

impl Drop for D {
    fn drop(&mut self) {}
}

#[inline]
fn foo() {
    let _d = D;
    unsafe { std::arch::asm!("", options(may_unwind)) };
}

// EMIT_MIR asm_unwind.main.Inline.diff
pub fn main() {
    // CHECK-LABEL: fn main(
    // CHECK: (inlined foo)
    // CHECK: asm!("", options(MAY_UNWIND)) -> [return: {{bb.*}}, unwind: [[unwind:bb.*]]];
    // CHECK: [[unwind]] (cleanup)
    foo();
}