[llvm-branch-commits] [mlir] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as `const` (PR #115597)

Matthias Springer via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Nov 9 01:41:53 PST 2024


https://github.com/matthias-springer created https://github.com/llvm/llvm-project/pull/115597

Same as `DominanceInfo`, all functions should be `const`.

Depends on #115587.

>From caea72f975d888838481d0544f52804192134a76 Mon Sep 17 00:00:00 2001
From: Matthias Springer <mspringer at nvidia.com>
Date: Sat, 9 Nov 2024 10:40:09 +0100
Subject: [PATCH] [mlir][IR][NFC] `PostDominanceInfo`: Mark all functions as
 `const`

Same as `DominanceInfo`, all functions should be `const`.

Depends on #115587.
---
 mlir/include/mlir/IR/Dominance.h | 8 ++++----
 mlir/lib/IR/Dominance.cpp        | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h
index a6b2475e12b1c6..63504cad211a4d 100644
--- a/mlir/include/mlir/IR/Dominance.h
+++ b/mlir/include/mlir/IR/Dominance.h
@@ -196,18 +196,18 @@ class PostDominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/true> {
 
   /// Return true if operation A properly postdominates operation B.
   bool properlyPostDominates(Operation *a, Operation *b,
-                             bool enclosingOpOk = true);
+                             bool enclosingOpOk = true) const;
 
   /// Return true if operation A postdominates operation B.
-  bool postDominates(Operation *a, Operation *b) {
+  bool postDominates(Operation *a, Operation *b) const {
     return a == b || properlyPostDominates(a, b);
   }
 
   /// Return true if the specified block A properly postdominates block B.
-  bool properlyPostDominates(Block *a, Block *b);
+  bool properlyPostDominates(Block *a, Block *b) const;
 
   /// Return true if the specified block A postdominates block B.
-  bool postDominates(Block *a, Block *b) {
+  bool postDominates(Block *a, Block *b) const {
     return a == b || properlyPostDominates(a, b);
   }
 };
diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp
index 25bdc32dd6a2a7..1c54e09d29b9b5 100644
--- a/mlir/lib/IR/Dominance.cpp
+++ b/mlir/lib/IR/Dominance.cpp
@@ -352,13 +352,13 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const {
 //===----------------------------------------------------------------------===//
 
 bool PostDominanceInfo::properlyPostDominates(Operation *a, Operation *b,
-                                              bool enclosingOpOk) {
+                                              bool enclosingOpOk) const {
   return super::properlyDominatesImpl(a->getBlock(), a->getIterator(),
                                       b->getBlock(), b->getIterator(),
                                       enclosingOpOk);
 }
 
-bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) {
+bool PostDominanceInfo::properlyPostDominates(Block *a, Block *b) const {
   return super::properlyDominatesImpl(a, a->end(), b, b->end(),
                                       /*enclosingOk=*/true);
 }



More information about the llvm-branch-commits mailing list