Closed
Description
The following code (the custom mir syntax is provisional):
#![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 = f(), bb1, Cleanup(bb2))
}
bb1 = {
RET = a;
Return()
}
bb2 (cleanup) = {
RET = a;
Resume()
}
)
}
Generates invalid LLVM IR, because code generation incorrectly assumes a
is defined when f
unwinds:
Instruction does not dominate all uses!
%3 = invoke i32 @_ZN1a1f17h84769ced50b3359cE()
to label %16 unwind label %10
store i32 %3, ptr %2, align 4
in function _ZN1a1f17h84769ced50b3359cE
LLVM ERROR: Broken function found, compilation aborted!