[Mlir-commits] [mlir] [mlir] Enable remove-dead-values to delete unused private function (PR #161471)
lonely eagle
llvmlistbot at llvm.org
Wed Oct 1 09:12:57 PDT 2025
linuxlonelyeagle wrote:
> > I believe such a fix is reasonable.In this bug, the key reason is that the dead code analysis pass determined the entire IR to be dead.This led to unexpected results in liveness analysis
>
> Can you describe a bit more the underlying issue?
```
mlir-opt test.mlir -remove-dead-values -allow-unregistered-dialect -debug &> log
...
[liveness-analysis LivenessAnalysis.cpp:299 1] RunLivenessAnalysis initialized for op: builtin.module check on unreachable code now:
[liveness-analysis LivenessAnalysis.cpp:307 1] Result: 0 of %c0_i64 = arith.constant 0 : i64 has no liveness info (unreachable), mark dead
[liveness-analysis LivenessAnalysis.cpp:307 1] Result: 0 of %0 = arith.cmpi eq, %arg0, %c0_i64 : i64 has no liveness info (unreachable), mark dead
[liveness-analysis LivenessAnalysis.cpp:307 1] Result: 0 of %c1_i64 = arith.constant 1 : i64 has no liveness info (unreachable), mark dead
[liveness-analysis LivenessAnalysis.cpp:307 1] Result: 0 of %c3_i64 = arith.constant 3 : i64 has no liveness info (unreachable), mark dead
```
Why did the above result occur in the liveness analysis?
Because they are dead code in dead code analysis.
Why are they dead code?
Because private functions have no caller.
This is the motivation behind why this PR was done in this manner.
cc: @ftynse @joker-eph
https://github.com/llvm/llvm-project/pull/161471
More information about the Mlir-commits
mailing list