[Mlir-commits] [mlir] [MLIR][RemoveDeadValues] Fix affine.for induction variable incorrectly removed (PR #172612)

Mehdi Amini llvmlistbot at llvm.org
Wed Dec 17 10:13:35 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
----------------
joker-eph wrote:

> hey 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)

Of course I wasn't asking about `visitBranchOperand` as a whole, but specifically about #161117



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


More information about the Mlir-commits mailing list