[Mlir-commits] [mlir] [MLIR][RemoveDeadValues] Fix affine.for induction variable incorrectly removed (PR #172612)
Francisco Geiman Thiesen
llvmlistbot at llvm.org
Wed Dec 17 09:56:24 PST 2025
================
@@ -327,6 +328,32 @@ RunLivenessAnalysis::RunLivenessAnalysis(Operation *op) {
solver.load<LivenessAnalysis>(symbolTable);
LDBG() << "Initializing and running solver";
(void)solver.initializeAndRun(op);
+
+ // Mark block arguments of RegionBranchOpInterface ops that are NOT successor
+ // inputs as live. These include induction variables (IVs) like those in
+ // affine.for or scf.for. The fix in visitBranchOperand() only handles this
----------------
FranciscoThiesen wrote:
I've updated the comment.
In a bit more detail, after the last commit:
- visitBranchOperand() handles region-to-region transitions but is only called when non-forwarded operands exist
- This fix handles parent-to-region transitions unconditionally
- They are complementary: visitBranchOperand() is still relevant for ops that have non-forwarded operands, and it does other things beyond
marking IVs (memory effect checks, result liveness propagation)
- This fix ensures IVs are caught regardless of whether visitBranchOperand() runs
https://github.com/llvm/llvm-project/pull/172612
More information about the Mlir-commits
mailing list