[Mlir-commits] [mlir] [mlir] Add erase sub-region dominate tree logic in DominanceInfoBase::invalidate method (PR #192469)

Mehdi Amini llvmlistbot at llvm.org
Mon Apr 20 01:58:52 PDT 2026


================
@@ -47,6 +47,19 @@ void DominanceInfoBase<IsPostDom>::invalidate(Region *region) {
     delete it->second.getPointer();
     dominanceInfos.erase(it);
   }
+
+  // Invalidate dominator trees of nested sub-regions.
+  if (region) {
+    region->walk([&](Operation *op) {
+      for (Region &region : op->getRegions()) {
+        auto it = dominanceInfos.find(&region);
+        if (it != dominanceInfos.end()) {
+          delete it->second.getPointer();
+          dominanceInfos.erase(it);
+        }
+      }
+    });
+  }
----------------
joker-eph wrote:

I think the entire function could just be replaced with:
```
region->walk([&](Region *visited) {
  ...
}
```

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


More information about the Mlir-commits mailing list