Flatten control-flow in inline_asm_call after verification

This commit is contained in:
Zalathar 2025-05-10 21:25:17 +10:00
parent b6300294a8
commit eccf0647d3

View File

@ -476,10 +476,15 @@ pub(crate) fn inline_asm_call<'ll>(
debug!("Asm Output Type: {:?}", output);
let fty = bx.cx.type_func(&argtys, output);
// Ask LLVM to verify that the constraints are well-formed.
let constraints_ok = unsafe { llvm::LLVMRustInlineAsmVerify(fty, cons.as_ptr(), cons.len()) };
debug!("constraint verification result: {:?}", constraints_ok);
if constraints_ok {
if !constraints_ok {
// LLVM has detected an issue with our constraints, so bail out.
return None;
}
let v = unsafe {
llvm::LLVMGetInlineAsm(
fty,
@ -532,10 +537,6 @@ pub(crate) fn inline_asm_call<'ll>(
llvm::LLVMSetMetadata(call, kind, md);
Some(call)
} else {
// LLVM has detected an issue with our constraints, bail out
None
}
}
/// If the register is an xmm/ymm/zmm register then return its index.