[Mlir-commits] [mlir] [mlir][CSE] Fix CSE markAnalysesPreserved<DominanceInfo, PostDominanceInfo> comment (PR #190471)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sat Apr 4 09:10:57 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: lonely eagle (linuxlonelyeagle)

<details>
<summary>Changes</summary>

The original comment claimed that DominanceInfo and PostDominanceInfo could be preserved because region operations are not removed. However, the real reason was that the original CSE only deleted redundant operations without moving any operation to a different block, leaving the dominance tree structure unchanged. Part of https://github.com/llvm/llvm-project/pull/180556.

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


1 Files Affected:

- (modified) mlir/lib/Transforms/CSE.cpp (+3-2) 


``````````diff
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index b8f3999d45f59..4d25e5e7c92b6 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -433,7 +433,8 @@ void CSE::runOnOperation() {
   if (!changed)
     return markAllAnalysesPreserved();
 
-  // We currently don't remove region operations, so mark dominance as
-  // preserved.
+  // We only delete redundant operations without moving any operation to a
+  // different block, so the dominance tree structure remains unchanged and
+  // DominanceInfo/PostDominanceInfo can be safely preserved.
   markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
 }

``````````

</details>


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


More information about the Mlir-commits mailing list