[Mlir-commits] [mlir] [mlir][dataflow] Fix LivenessAnalysis/RemoveDeadValues handling of loop induction variables (PR #161117)

Mehdi Amini llvmlistbot at llvm.org
Mon Oct 20 07:58:41 PDT 2025


================
@@ -165,6 +165,28 @@ void LivenessAnalysis::visitBranchOperand(OpOperand &operand) {
           blocks.push_back(&block);
       }
     }
+
+    // In the block of the successor block argument of RegionBranchOpInterface,
+    // there may be arguments of RegionBranchOpInterface, such as the IV of
+    // scf.forOp. Explicitly set this argument to live.
+    auto regionBranchOp = cast<RegionBranchOpInterface>(op);
----------------
joker-eph wrote:

Can you change line 140 to be:

```
if (auto regionBranchOp = dyn_cast<RegionBranchOpInterface>(op)) {
```

and remove this line?

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


More information about the Mlir-commits mailing list