[llvm] [SPIRV] Add support for SPV_KHR_abort extension (PR #193037)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 05:12:20 PDT 2026
================
@@ -6250,6 +6253,63 @@ bool SPIRVInstructionSelector::selectAllocaArray(Register ResVReg,
return true;
}
+bool SPIRVInstructionSelector::selectAbort(MachineInstr &I) const {
+ if (!STI.canUseExtension(SPIRV::Extension::SPV_KHR_abort))
+ report_fatal_error("OpAbortKHR instruction requires the following "
+ "SPIR-V extension: SPV_KHR_abort",
+ false);
+ // The intrinsic is declared as variadic so it can carry composite message
+ // types (vectors and structs) without LLVM IR mangling restrictions, but
+ // OpAbortKHR takes exactly one Message operand.
+ if (I.getNumExplicitOperands() != 2)
+ report_fatal_error("llvm.spv.abort must be called with exactly one "
+ "message argument",
+ false);
----------------
jmmartinez wrote:
This kind of check should never happen in well-formed LLVM-IR right?
You could do it in the verifier. Or put an `assert(I.getNumExplicitOperands() == 2);` for the developers.
https://github.com/llvm/llvm-project/pull/193037
More information about the llvm-commits
mailing list