[llvm] [SPIRV] Addition of extension SPV_KHR_non_semantic_info and SPV_KHR_relaxed_extended_instruction (PR #169643)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 23 01:59:31 PST 2026


mgcarrasco wrote:

@aadeshps-mcw @michalpaszkowski I was checking the debug info support in the backend and tested this PR locally. I found a crash due to an incorrect call to the `SPIRVGlobalRegistry`. There is a missing `setCurrentFunc` call.

```
diff --git a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
index 664c1c26cffc..ecb0e736dc10 100644
--- a/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVEmitNonSemanticDI.cpp
@@ -584,6 +584,7 @@ bool SPIRVEmitNonSemanticDI::runOnModule(llvm::Module &M) {
     const RegisterBankInfo *RBI = TM->getSubtargetImpl()->getRegBankInfo();
     SPIRVGlobalRegistry *GR = TM->getSubtargetImpl()->getSPIRVGlobalRegistry();
 
+    GR->setCurrentFunc(*MF);
     const SPIRVType *VoidTy =
         GR->getOrCreateSPIRVType(Type::getVoidTy(M.getContext()), MIRBuilder,
                                  SPIRV::AccessQualifier::ReadWrite, false);
```

Test case:
```
target datalayout = "e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-v256:256-v512:512-v1024:1024-n32:64-S32-G1-P4-A0"
target triple = "spirv64-amd-amdhsa"

@__const.__assert_fail.fmt = external addrspace(1) constant [47 x i8]

define spir_func void @__assertfail() addrspace(4) {
entry:
  ret void
}

define spir_kernel void @_Z3fooPi() addrspace(4) {
entry:
  %input.addr = alloca ptr addrspace(4), align 8
  ret void
}
```

https://github.com/llvm/llvm-project/pull/169643


More information about the llvm-commits mailing list