[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `-remove-dead-values` on private functions (PR #169269)

Matthias Springer llvmlistbot at llvm.org
Mon Nov 24 06:09:36 PST 2025


================
@@ -118,6 +118,17 @@ func.func @main(%arg0 : i32) {
 
 // -----
 
+// CHECK-LABEL: func.func private @clean_func_op_remove_side_effecting_op() {
+// CHECK-NEXT:    return
+// CHECK-NEXT:  }
+func.func private @clean_func_op_remove_side_effecting_op(%arg0: i32) -> (i32) {
+  // vector.print has a side effect but the op is dead.
+  vector.print %arg0 : i32
+  return %arg0 : i32
+}
----------------
matthias-springer wrote:

Yes that is somewhat odd. It's because liveness here is a property of SSA values, not operations.

It looks like `-remove-dead-values` does not primarily remove dead operations. It does, however, remove some operations:
```c++
  LDBG()
      << "Simple op has all dead results and is memory effect free, scheduling "
         "for removal: "
      << OpWithFlags(op, OpPrintingFlags().skipRegions());
```




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


More information about the Mlir-commits mailing list