[Mlir-commits] [mlir] [mlir][CSE] Delete dead code immediately in CSE pass (PR #190926)

Adrian Kuegel llvmlistbot at llvm.org
Wed Apr 15 06:08:41 PDT 2026


akuegel wrote:

Just for reference, we also encountered the crash, and the simplified example I have is this one:

```
// CHECK-LABEL: @cse_dead_parent_duplicate_child
func.func @cse_dead_parent_duplicate_child(%arg0: i32) -> i32 {
  // CHECK: arith.addi
  %0 = arith.addi %arg0, %arg0 : i32

  // Parent 2 is trivially dead because its result is not used.
  // CHECK-NOT: scf.execute_region
  %1 = scf.execute_region -> i32 {
    %child2 = arith.addi %arg0, %arg0 : i32
    scf.yield %child2 : i32
  }

  return %0 : i32
}
```

Immediately deleting dead code would work if we had a listener that removes ops from opsToRemove if they have been deleted already. So if the plan is to re-install this PR, I can contribute that code with the listener.

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


More information about the Mlir-commits mailing list