[Mlir-commits] [mlir] [mlir] Add removeDomTree method to DominanceInfoBase (PR #192050)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Apr 14 05:54:23 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: lonely eagle (linuxlonelyeagle)

<details>
<summary>Changes</summary>

When a pass runs and marks markAnalysesPreserved<DominanceInfo, PostDominanceInfo>(), any deleted RegionOps that have associated dominator trees will keep those trees in memory until DominanceInfo is destructed. This PR introduces a removeDomTree method in DominanceInfoBase, allowing us to explicitly remove dominator trees in a timely manner.

---
Full diff: https://github.com/llvm/llvm-project/pull/192050.diff


1 Files Affected:

- (modified) mlir/include/mlir/IR/Dominance.h (+7) 


``````````diff
diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h
index 9e1254c1dfe1e..5ec455b3ec4da 100644
--- a/mlir/include/mlir/IR/Dominance.h
+++ b/mlir/include/mlir/IR/Dominance.h
@@ -104,6 +104,13 @@ class DominanceInfoBase {
     return *getDominanceInfo(region, /*needsDomTree=*/true).getPointer();
   }
 
+  void removeDomTree(Region *region) {
+    if (dominanceInfos.contains(region)) {
+      delete dominanceInfos[region].getPointer();
+      dominanceInfos.erase(region);
+    }
+  };
+
 protected:
   using super = DominanceInfoBase<IsPostDom>;
 

``````````

</details>


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


More information about the Mlir-commits mailing list