[PATCH] D78445: [MLIR] Mark dominance methods const
Uday Bondhugula via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 18 22:37:27 PDT 2020
bondhugula created this revision.
Herald added subscribers: llvm-commits, frgossen, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, rriddle, mehdi_amini.
Herald added a project: LLVM.
This change is in line with MLIR's coding style
https://mlir.llvm.org/getting_started/DeveloperGuide/
and also consistent with the dominance methods in LLVM.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78445
Files:
mlir/include/mlir/Analysis/Dominance.h
mlir/lib/Analysis/Dominance.cpp
Index: mlir/lib/Analysis/Dominance.cpp
===================================================================
--- mlir/lib/Analysis/Dominance.cpp
+++ mlir/lib/Analysis/Dominance.cpp
@@ -139,7 +139,7 @@
/// Return true if the specified block A properly dominates block B.
template <bool IsPostDom>
-bool DominanceInfoBase<IsPostDom>::properlyDominates(Block *a, Block *b) {
+bool DominanceInfoBase<IsPostDom>::properlyDominates(Block *a, Block *b) const {
// A block dominates itself but does not properly dominate itself.
if (a == b)
return false;
@@ -184,7 +184,7 @@
//===----------------------------------------------------------------------===//
/// Return true if operation A properly dominates operation B.
-bool DominanceInfo::properlyDominates(Operation *a, Operation *b) {
+bool DominanceInfo::properlyDominates(Operation *a, Operation *b) const {
auto *aBlock = a->getBlock(), *bBlock = b->getBlock();
// If a or b are not within a block, then a does not dominate b.
@@ -208,7 +208,7 @@
}
/// Return true if value A properly dominates operation B.
-bool DominanceInfo::properlyDominates(Value a, Operation *b) {
+bool DominanceInfo::properlyDominates(Value a, Operation *b) const {
if (auto *aOp = a.getDefiningOp()) {
// The values defined by an operation do *not* dominate any nested
// operations.
Index: mlir/include/mlir/Analysis/Dominance.h
===================================================================
--- mlir/include/mlir/Analysis/Dominance.h
+++ mlir/include/mlir/Analysis/Dominance.h
@@ -52,7 +52,7 @@
using super = DominanceInfoBase<IsPostDom>;
/// Return true if the specified block A properly dominates block B.
- bool properlyDominates(Block *a, Block *b);
+ bool properlyDominates(Block *a, Block *b) const;
/// A mapping of regions to their base dominator tree.
DenseMap<Region *, std::unique_ptr<base>> dominanceInfos;
@@ -65,28 +65,28 @@
using super::super;
/// Return true if operation A properly dominates operation B.
- bool properlyDominates(Operation *a, Operation *b);
+ bool properlyDominates(Operation *a, Operation *b) const;
/// Return true if operation A dominates operation B.
- bool dominates(Operation *a, Operation *b) {
+ bool dominates(Operation *a, Operation *b) const {
return a == b || properlyDominates(a, b);
}
/// Return true if value A properly dominates operation B.
- bool properlyDominates(Value a, Operation *b);
+ bool properlyDominates(Value a, Operation *b) const;
/// Return true if operation A dominates operation B.
- bool dominates(Value a, Operation *b) {
+ bool dominates(Value a, Operation *b) const {
return (Operation *)a.getDefiningOp() == b || properlyDominates(a, b);
}
/// Return true if the specified block A dominates block B.
- bool dominates(Block *a, Block *b) {
+ bool dominates(Block *a, Block *b) const {
return a == b || properlyDominates(a, b);
}
/// Return true if the specified block A properly dominates block B.
- bool properlyDominates(Block *a, Block *b) {
+ bool properlyDominates(Block *a, Block *b) const {
return super::properlyDominates(a, b);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78445.258578.patch
Type: text/x-patch
Size: 3183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200419/beb70952/attachment.bin>
More information about the llvm-commits
mailing list