[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
Wed Dec 31 14:39:57 PST 2025


================
@@ -975,7 +811,27 @@ void RemoveDeadValues::runOnOperation() {
     }
   });
 
-  cleanUpDeadVals(finalCleanupList);
+  MLIRContext *context = module->getContext();
+  cleanUpDeadVals(context, finalCleanupList);
----------------
rengolin wrote:

IIUC, in case all deletable values are already poison (fixed point above), this will not be skipped (need to check if the values are actually poison).

The multiple checks in `cleanUpDeadVals` also do not seem to short-cut for the values that are already poison, and you'll always call `processRegionBranchOp`. 

Perhaps just not adding them to the list if they're already poison will make the list `null` and return early, then the canonicalization below can just do its job?

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


More information about the llvm-branch-commits mailing list