-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Labels
Description
If we try to run the SPIR-V backend on IR with a zero element array and we're not targeting a shader, we get an assertion saying zero element arrays are not supported.
Since this is legal IR, the backend should legalize this to something that is supported.
This IR pattern was seen in real code generated from the OpenMP frontend, and they requested a backend fix instead of changing what the FE generates.
repro.ll
define i32 @foo() {
%1 = alloca [0 x i8]
ret i32 0
}
llc -mtriple spirv64 repro.ll
llvm::SPIRVType* llvm::SPIRVGlobalRegistry::getOpTypeArray(uint32_t, llvm::SPIRVType*, llvm::MachineIRBuilder&, bool, bool): Assertion `ST.isShader() && "Runtime arrays are not allowed in non-shader " "SPIR-V modules."' failed.
PLEASE submit a bug report to https://github.com/intel/llvm/issues and include the crash backtrace and instructions to reproduce the bug.