[Mlir-commits] [mlir] [mlir] Fix RemoveDeadRegionBranchOpSuccessorInputs producing invalid scf.for (LoopLikeOpInterface tie) (PR #216627)

Maksim Levental llvmlistbot at llvm.org
Mon Aug 17 10:19:29 PDT 2026


makslevental wrote:

> I think this is still broken for `scf.while`. I still think that [this](https://discourse.llvm.org/t/rfc-structural-and-reachable-control-flow-edges-in-regionbranchopinterface/90496) is the right approach (happy to be convinced otherwise if there's another strategy that fixes the problem), but there was pushback and I stopped working on this for now. Your fix in this PR is actually somewhat similar, but limited to loop-like ops.

`scf.while` isn't affected by this bug

1. `WhileOp::getSuccessorRegions` does no trip-count pruning and always reports the full CFG
2. `ConditionOp::getMutableSuccessorOperands` returns the same operand for both edges. 
3. Because `getSuccessorOperandInputMapping` keys by the `OpOperand*`, that same operand maps to both `result[i]` and `after_arg[i]`, so `computeTiedSuccessorInputs` already ties them.



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


More information about the Mlir-commits mailing list