[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:21 PDT 2026
================
@@ -595,6 +598,62 @@ SPIRVPrepareFunctions::removeAggregateTypesFromSignature(Function *F) {
return NewF;
}
+// Replace OpenCL/SPIR-V style calls to `__spirv_AbortKHR(message)` with calls
+// to the `llvm.spv.abort` target intrinsic, so that they go through the same
+// instruction-selection path as the intrinsic and get lowered to OpAbortKHR.
+bool SPIRVPrepareFunctions::substituteAbortKHRCalls(Function *F) {
+ if (F->isDeclaration())
+ return false;
+
+ SmallVector<CallInst *> Calls;
+ for (Instruction &I : instructions(F)) {
----------------
jmmartinez wrote:
I think calls to `@llvm.trap` should also translate to a call to `spv_abort` (if and only if the extension is available). Currently a call to `@llvm.trap` leads to a no-op that is against the langref specification.
https://github.com/llvm/llvm-project/pull/193037
More information about the llvm-commits
mailing list