[Mlir-commits] [mlir] [mlir][Transforms] Fix crash in `-remove-dead-values` on private functions (PR #169269)
Matthias Springer
llvmlistbot at llvm.org
Tue Nov 25 23:26:11 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:
#162038 touches the same pass, but it looks like it's solving a different issue. The problem there is related to public functions.
> this logic that you quote makes somehow sense to me: based on liveness of the results we figure that an op is dead.
> Doing the same based on operands is less clear to me.
My reasoning is: If the liveness analysis determines that an SSA value is dead, so must be all users of that SSA values. If there were live users (with a side effect), the analysis would not have marked the SSA value as "dead". Is there a flaw in my conclusion?
https://github.com/llvm/llvm-project/pull/169269
More information about the Mlir-commits
mailing list