[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `-remove-dead-values` on private functions (PR #169269)
Mehdi Amini
llvmlistbot at llvm.org
Mon Nov 24 05:38:37 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
+}
----------------
joker-eph wrote:
Oh I missed this: it's dead because it's unreachable...
What's weird is that we infer this from the fact that at least one operand is dead, correct?
However the check isn't path sensitive:
```
v = foo()
if (false) {
print(v) # checking liveness of `v` should indicate that it is live here right?
}
use(v)
```
https://github.com/llvm/llvm-project/pull/169269
More information about the Mlir-commits
mailing list