summaryrefslogtreecommitdiffstats
path: root/tests/ui/mir/ssa_call_ret.rs
blob: 6132a6691dea3a219008123eb2057a826c87900b (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
29
30
// Regression test for issue #117331, where variable `a` was misidentified as
// being in SSA form (the definition occurs on the return edge only).
//
// edition:2021
// compile-flags: --crate-type=lib
// build-pass
// needs-unwind
#![feature(custom_mir, core_intrinsics)]
use core::intrinsics::mir::*;

#[custom_mir(dialect = "runtime", phase = "optimized")]
pub fn f() -> u32 {
    mir!(
        let a: u32;
        {
            Call(a = g(), bb1, UnwindCleanup(bb2))
        }
        bb1 = {
            RET = a;
            Return()
        }
        bb2 (cleanup) = {
            RET = a;
            UnwindResume()
        }
    )
}

#[inline(never)]
pub fn g() -> u32 { 0 }