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

Mehdi Amini llvmlistbot at llvm.org
Wed Aug 19 04:51:00 PDT 2026


================
@@ -80,8 +80,11 @@ bool Sinker::allUsersDominatedBy(Operation *op, Region *region) {
          "expected op to be defined outside the region");
   return llvm::all_of(op->getUsers(), [&](Operation *user) {
     // The user is dominated by the region if its containing block is dominated
-    // by the region's entry block.
-    return domInfo.dominates(&region->front(), user->getBlock());
+    // by the region's entry block. Additionally, allow users that are in
+    // descendant regions of the region (e.g., nested loops) since those
+    // should still permit sinking into the outer region.
+    return domInfo.dominates(&region->front(), user->getBlock()) ||
+           region->isAncestor(user->getParentRegion());
----------------
joker-eph wrote:

I don't quite get this addition?

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


More information about the Mlir-commits mailing list