[Mlir-commits] [mlir] [mlir][Transforms] `remove-dead-values`: Rely on canonicalizer for region simplification (PR #173505)
Matthias Springer
llvmlistbot at llvm.org
Thu Jan 1 03:57:54 PST 2026
================
@@ -975,7 +811,27 @@ void RemoveDeadValues::runOnOperation() {
}
});
- cleanUpDeadVals(finalCleanupList);
+ MLIRContext *context = module->getContext();
+ cleanUpDeadVals(context, finalCleanupList);
----------------
matthias-springer wrote:
There is no fixed-point iteration up until this point anymore. That code was deleted in this PR (see the large erased block of code `processRegionBranchOp`). The only thing that happens until this point: the cleanup list (`RDVFinalCleanupList`) is populated based on liveness information.
`RDVFinalCleanupList` contains instructions such as "erase this value", "erase this operation" or "replace all uses of this value with ub.poison". These instructions are materialized during `cleanUpDeadVals`. In case of `RegionBranchOpInterface` ops, we don't erase any values, but merely remove their uses with `ub.poison`. The actual removal then happens when the canonicalization patterns are applied below.
One way to think about this: in case of `RegionBranchOpInterface` ops, we don't erase any values anymore. Instead, we just augment the IR with liveness information (by swapping operands with `ub.poison`). This simplifies the IR good enough for the canonicalization patterns to (incrementally) perform the cleanup.
https://github.com/llvm/llvm-project/pull/173505
More information about the Mlir-commits
mailing list