[llvm-branch-commits] [mlir] [mlir][Transforms] `remove-dead-values`: Rely on canonicalizer for region simplification (PR #173505)
Renato Golin via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Jan 1 13:29:52 PST 2026
================
@@ -246,7 +246,17 @@ def RemoveDeadValues : Pass<"remove-dead-values"> {
do = square_and_double_of_y(5)
print(do)
```
+
+ Note: If `canonicalize` is set to "false", this pass does not remove any
+ block arguments / op results from ops that implement the
+ RegionBranchOpInterface. Instead, it just sets dead operands to
+ "ub.poison".
----------------
rengolin wrote:
> There is no fixed-point iteration / greedy pattern rewrite with `canonicalize=false`
By fixed point I meant "running the same pass over and over" until fixed point. This is only relevant if the pass isn't one-shot with all replacements (which I think you mean it is), so ignore that part.
> By "checks" I mean mainly the liveness analysis, which is computed at the beginning of every pass invocation.
Exactly, that's what I meant. So, if you do `-rdv=false`, then other passes, then `-rdv=true`, you'll run the whole liveness analysis again, just to realize all values have already been replaced by poison.
I was thinking of the case where you run `-rdv` and not all patterns can be recognized (ex. needs inlining or DCE or hoisting) and then you run again, which recognizes the missing patterns, marks them all as poison, and then canonicalize. But in this case, I guess running twice with canonicalization would perform the same action (first canon would not remove) anyway, and the second liveness analysis is still required, so no extra work is done.
If I just proved my comment irrelevant, feel free to close this conversation. :smile:
https://github.com/llvm/llvm-project/pull/173505
More information about the llvm-branch-commits
mailing list