[Mlir-commits] [mlir] [mlir][spirv] Split conditional basic blocks during deserialization (PR #127639)

Igor Wodiany llvmlistbot at llvm.org
Wed Feb 19 06:33:39 PST 2025


================
@@ -105,6 +105,8 @@ spirv.module Logical GLSL450 requires #spirv.vce<v1.0, [Shader], []> {
     %var = spirv.Variable : !spirv.ptr<i1, Function>
 // CHECK-NEXT:    spirv.Branch ^[[BB:.+]]
 // CHECK-NEXT:  ^[[BB]]:
+// CHECK:    spirv.Branch ^[[BB:.+]]
+// CHECK-NEXT:  ^[[BB]]:
----------------
IgWod-IMG wrote:

Thanks for sharing it. I am a bit confused, because I didn't intend to affect loops, so I started looking into a simpler example and it seems to me that the loop continue block (https://mlir.llvm.org/docs/Dialects/SPIR-V/#loop) gets split into two. It wasn't my intention:

```c
    // Do not split loop headers
    if (auto it = blockMergeInfo.find(block); it != blockMergeInfo.end()) {
      if (it->second.continueBlock) {
        return;
      }
    }
```

(I incorrectly called it a loop header here)

Let me investigate what's happing first and then I'll come back to you. There is no point in engaging into a deeper discussion when the problem may lie in an incorrect implementation :)

https://github.com/llvm/llvm-project/pull/127639


More information about the Mlir-commits mailing list