Open dneto0 opened 6 years ago
Occurs even if the body is only: A[3] = structval[n].v;
The problem occurs in SPIRVProducer, when changing a __constant variable address space to module-scope Private.
Trouble occurs with this instruction: %v = getelementptr inbounds [2 x %struct.S], [2 x %struct.S] addrspace(2) bitcast (<{ { <4 x float>, float }, { <4 x float>, float } }> addrspace(2) @structval to [2 x %struct.S] addrspace(2)*), i32 0, i32 %n, i32 1
The code is trying to convert the use of @structval to pointer-to-private, but you can't just replace the use in an LLVM-constant expression.
On this input:
I get:
clspv: /build/dneto/aglet/SPIRV-LLVM/third_party/llvm/lib/IR/User.cpp:26: void llvm::User::replaceUsesOfWith(llvm::Value, llvm::Value): Assertion `(!isa(this) || isa(this)) && "Cannot call User::replaceUsesOfWith on a constant!"' failed.