[Mlir-commits] [mlir] 01dcc41 - [mlir][IR][NFC] `DominanceInfo`: Minor code cleanups (#115430)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Nov 12 01:57:00 PST 2024
Author: Matthias Springer
Date: 2024-11-12T18:56:57+09:00
New Revision: 01dcc41cb856b6ed095a26315faa47d2ae9ce105
URL: https://github.com/llvm/llvm-project/commit/01dcc41cb856b6ed095a26315faa47d2ae9ce105
DIFF: https://github.com/llvm/llvm-project/commit/01dcc41cb856b6ed095a26315faa47d2ae9ce105.diff
LOG: [mlir][IR][NFC] `DominanceInfo`: Minor code cleanups (#115430)
Remove `properlyDominatesImpl` and implement the functionality in
`properlyDominates` directly.
Added:
Modified:
mlir/include/mlir/IR/Dominance.h
mlir/lib/IR/Dominance.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/Dominance.h b/mlir/include/mlir/IR/Dominance.h
index 66b9456533ae04..2947bdc21dfebf 100644
--- a/mlir/include/mlir/IR/Dominance.h
+++ b/mlir/include/mlir/IR/Dominance.h
@@ -147,9 +147,7 @@ class DominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/false> {
/// The `enclosingOpOk` flag says whether we should return true if the B op
/// is enclosed by a region on A.
bool properlyDominates(Operation *a, Operation *b,
- bool enclosingOpOk = true) const {
- return properlyDominatesImpl(a, b, enclosingOpOk);
- }
+ bool enclosingOpOk = true) const;
/// Return true if operation A dominates operation B, i.e. if A and B are the
/// same operation or A properly dominates B.
@@ -187,13 +185,6 @@ class DominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/false> {
bool properlyDominates(Block *a, Block *b) const {
return super::properlyDominates(a, b);
}
-
-private:
- // Return true if operation A properly dominates operation B. The
- /// 'enclosingOpOk' flag says whether we should return true if the b op is
- /// enclosed by a region on 'A'.
- bool properlyDominatesImpl(Operation *a, Operation *b,
- bool enclosingOpOk) const;
};
/// A class for computing basic postdominance information.
diff --git a/mlir/lib/IR/Dominance.cpp b/mlir/lib/IR/Dominance.cpp
index 62477a823acaaf..c9b8ee69c24570 100644
--- a/mlir/lib/IR/Dominance.cpp
+++ b/mlir/lib/IR/Dominance.cpp
@@ -230,7 +230,7 @@ bool DominanceInfoBase<IsPostDom>::properlyDominates(Block *a, Block *b) const {
if (regionA != b->getParent()) {
b = regionA ? regionA->findAncestorBlockInRegion(*b) : nullptr;
// If we could not find a valid block b then it is a not a dominator.
- if (b == nullptr)
+ if (!b)
return false;
// Check to see if the ancestor of `b` is the same block as `a`. A properly
@@ -266,8 +266,8 @@ template class detail::DominanceInfoBase</*IsPostDom=*/false>;
/// Return true if operation `a` properly dominates operation `b`. The
/// 'enclosingOpOk' flag says whether we should return true if the `b` op is
/// enclosed by a region on 'a'.
-bool DominanceInfo::properlyDominatesImpl(Operation *a, Operation *b,
- bool enclosingOpOk) const {
+bool DominanceInfo::properlyDominates(Operation *a, Operation *b,
+ bool enclosingOpOk) const {
Block *aBlock = a->getBlock(), *bBlock = b->getBlock();
assert(aBlock && bBlock && "operations must be in a block");
@@ -319,7 +319,7 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const {
// `a` properlyDominates `b` if the operation defining `a` properlyDominates
// `b`, but `a` does not itself enclose `b` in one of its regions.
- return properlyDominatesImpl(a.getDefiningOp(), b, /*enclosingOpOk=*/false);
+ return properlyDominates(a.getDefiningOp(), b, /*enclosingOpOk=*/false);
}
//===----------------------------------------------------------------------===//
More information about the Mlir-commits
mailing list