[Mlir-commits] [mlir] [MLIR] Fix control-flow sinking through nested regions (PR #217168)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Aug 20 02:25:28 PDT 2026
================
@@ -91,12 +91,13 @@ void Sinker::tryToSinkPredecessors(Operation *user, Region *region,
<< OpWithFlags(user, OpPrintingFlags().skipRegions());
for (Value value : user->getOperands()) {
Operation *op = value.getDefiningOp();
- // Ignore block arguments and ops that are already inside the region.
- if (!op || op->getParentRegion() == region)
+ // Ignore block arguments and ops already contained in the target region,
+ // including ops in nested regions.
+ // region.
+ if (!op || region->isAncestor(op->getParentRegion()))
----------------
MarkVeerasingam wrote:
Thanks, I tried this change locally, but `region->isAncestor(op)` doesn't compile:
```
error: cannot convert ‘mlir::Operation*’ to ‘mlir::Region*’
97 | if (!op || region->isAncestor(op))
| ^~
| |
| mlir::Operation*
```
https://github.com/llvm/llvm-project/pull/217168
More information about the Mlir-commits
mailing list