[Mlir-commits] [mlir] [MLIR] Fix control-flow sinking through nested regions (PR #217168)

Longsheng Mou llvmlistbot at llvm.org
Wed Aug 19 23:57:33 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()))
----------------
CoTinker wrote:

Why not
```suggestion
    if (!op || region->isAncestor(op))
```


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


More information about the Mlir-commits mailing list