| Issue |
162841
|
| Summary |
[HLSL][SPIRV] LLVM opt create phi node for resource handle.
|
| Labels |
HLSL,
backend:SPIR-V
|
| Assignees |
s-perron
|
| Reporter |
s-perron
|
There are cases where PRE is moving calls to the intrinsic `@llvm.spv.resrouce.handlefrombinding` so that the parameter to `@llvm.spv.resource.getpointer` comes from a `phi` instruction. This cause the intrinsic expansion in the SPIR-V backend to fail because each resource access must have a single resource that it is accessing. The `phi` instruction makes it look like there could be more, even if all paths have the same value.
See https://godbolt.org/z/qYanxY15K.
Source code is
```
RWStructuredBuffer<int> Out[4] : register(u0);
[numthreads(4,1,1)]
void main(uint GI : SV_GroupIndex) {
for (int i = 0; i < GI; i++)
Out[NonUniformResourceIndex(GI)].IncrementCounter();
Out[NonUniformResourceIndex(GI)][0] = Out[NonUniformResourceIndex(GI)].IncrementCounter();
}
```
Note that this does not happen when targeting DXIL: https://godbolt.org/z/brYovMbEd.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs