[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:38 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:
Yes, but it property errors out a bit after this. If we don't do this it still crashes with an error, with this there's just an error.
https://github.com/llvm/llvm-project/pull/169732
More information about the llvm-commits
mailing list