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

lonely eagle llvmlistbot at llvm.org
Sat Apr 4 09:10:22 PDT 2026


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

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.

>From c5ab86d102cd592951555b0c8b345c384eee2923 Mon Sep 17 00:00:00 2001
From: linuxlonelyeagle <2020382038 at qq.com>
Date: Sat, 4 Apr 2026 16:08:03 +0000
Subject: [PATCH] fix CSE markAnalysesPreserved<DominanceInfo,
 PostDominanceInfo> comment.

---
 mlir/lib/Transforms/CSE.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

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>();
 }



More information about the Mlir-commits mailing list