[llvm] [SPIRV] Error for zero-length arrays if not a shader (PR #169732)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 27 00:48:52 PST 2025
================
@@ -883,10 +883,15 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeArray(uint32_t NumElems,
.addUse(NumElementsVReg);
});
} else {
- assert(ST.isShader() && "Runtime arrays are not allowed in non-shader "
- "SPIR-V modules.");
- if (!ST.isShader())
- return nullptr;
+ if (!ST.isShader()) {
+ Function &Fn = MIRBuilder.getMF().getFunction();
+ Fn.getContext().diagnose(DiagnosticInfoUnsupported(
+ Fn,
+ "Runtime arrays are not allowed in non-shader "
+ "SPIR-V modules",
+ MIRBuilder.getDebugLoc()));
+ return ElemType;
----------------
jmmartinez wrote:
Does `diagnose(...)` return and continues executing the backend code?
https://github.com/llvm/llvm-project/pull/169732
More information about the llvm-commits
mailing list