[MLIR] Mark dominance methods const

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.

Differential Revision: https://reviews.llvm.org/D78445
This commit is contained in:
Uday Bondhugula
2020-04-19 10:51:58 +05:30
parent 2a58271158
commit 2abd50a359
2 changed files with 10 additions and 10 deletions

View File

@@ -52,7 +52,7 @@ protected:
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 @@ public:
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);
}

View File

@@ -139,7 +139,7 @@ DominanceInfoNode *DominanceInfoBase<IsPostDom>::getNode(Block *a) {
/// 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 @@ template class mlir::detail::DominanceInfoBase</*IsPostDom=*/false>;
//===----------------------------------------------------------------------===//
/// 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 @@ bool DominanceInfo::properlyDominates(Operation *a, Operation *b) {
}
/// 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.