[Mlir-commits] [mlir] [mlir][gpu] Fix crash in RemoveDeadValues pass with gpu.launch ops (PR #182711)

Fedor Nikolaev llvmlistbot at llvm.org
Sat Feb 21 15:16:02 PST 2026


felichita wrote:

Still has some underlying issue with poison on bb2 . Any thoughts?

```
./build/bin/mlir-opt build/rm-dead-values.mlir --remove-dead-values
module {
  func.func @main() -> i64 {
    %c0_i64 = arith.constant 0 : i64
    %c1_i64 = arith.constant 1 : i64
    %0 = arith.addi %c0_i64, %c1_i64 : i64
    %c2_i64 = arith.constant 2 : i64
    %1 = arith.muli %0, %c2_i64 : i64
    %c3_i64 = arith.constant 3 : i64
    %2 = arith.divsi %1, %c3_i64 : i64
    %c4_i64 = arith.constant 4 : i64
    %3 = arith.subi %2, %c4_i64 : i64
    %c5_i64 = arith.constant 5 : i64
    %4 = arith.cmpi slt, %3, %c5_i64 : i64
    cf.cond_br %4, ^bb1, ^bb2
  ^bb1:  // pred: ^bb0
    %c10_i64 = arith.constant 10 : i64
    cf.br ^bb3(%c10_i64 : i64)
  ^bb2:  // pred: ^bb0
    %5 = ub.poison : i64
    cf.br ^bb3(%5 : i64)
  ^bb3(%6: i64):  // 2 preds: ^bb1, ^bb2
    %c1 = arith.constant 1 : index
    gpu.launch blocks(%arg0, %arg1, %arg2) in (%arg6 = %c1, %arg7 = %c1, %arg8 = %c1) threads(%arg3, %arg4, %arg5) in (%arg9 = %c1, %arg10 = %c1, %arg11 = %c1) {
      gpu.terminator
    }
    %7 = arith.addi %3, %6 : i64
    return %7 : i64
  }
}
```

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


More information about the Mlir-commits mailing list