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

lonely eagle llvmlistbot at llvm.org
Mon Apr 20 06:04:21 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);
+        }
+      }
+    });
+  }
----------------
linuxlonelyeagle wrote:

That's great! I actually didn't know that.

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


More information about the Mlir-commits mailing list