Issue 165642
Summary [llvm][HLSL][SPIR-V] Incorrect transforms for nested loop with wave operations
Labels llvm:transforms, clang:HLSL:SPIRV
Assignees luciechoi
Reporter luciechoi
    ```
RWStructuredBuffer<uint> Out : register(u0);

[numthreads(8,8,1)]
void main(uint3 TID : SV_GroupThreadID) {
    for (uint i = 0; i < 8; i++) {
        for (uint j = 0; j < 8; j++) {
            if (i == TID.x && j == TID.y) {
 uint index = TID.x * 8 + TID.y;
                Out[index] = WaveActiveMax(index);
                break;
            }
        }
 }
}
```

Found while working on https://github.com/llvm/llvm-project/issues/164496. Child of https://github.com/llvm/llvm-project/issues/136930.

The issues are potentially with `SimplifyCFG`, `JumpThreading`, and `GVN` passes, where instructions are folded 
```
Loop intrinsic cannot be preceded by a convergent operation in the same basic block.
  %4 = call token @llvm.experimental.convergence.loop() [ "convergencectrl"(token %0) ]
in function main
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to