[llvm] [SPIRV] Error for zero-length arrays if not a shader (PR #169732)
Nick Sarnie via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 07:02:58 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;
----------------
sarnex wrote:
Replied to the same comment in Jose's review of this, thanks.
https://github.com/llvm/llvm-project/pull/169732
More information about the llvm-commits
mailing list