Skip to content

Commit 8bc07a5

Browse files
[mlir][IR][NFC] DominanceInfo: Minor code cleanups
1 parent 595f3e9 commit 8bc07a5

File tree

2 files changed

+5
-14
lines changed

2 files changed

+5
-14
lines changed

mlir/include/mlir/IR/Dominance.h

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,7 @@ class DominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/false> {
147147
/// The `enclosingOpOk` flag says whether we should return true if the B op
148148
/// is enclosed by a region on A.
149149
bool properlyDominates(Operation *a, Operation *b,
150-
bool enclosingOpOk = true) const {
151-
return properlyDominatesImpl(a, b, enclosingOpOk);
152-
}
150+
bool enclosingOpOk = true) const;
153151

154152
/// Return true if operation A dominates operation B, i.e. if A and B are the
155153
/// same operation or A properly dominates B.
@@ -187,13 +185,6 @@ class DominanceInfo : public detail::DominanceInfoBase</*IsPostDom=*/false> {
187185
bool properlyDominates(Block *a, Block *b) const {
188186
return super::properlyDominates(a, b);
189187
}
190-
191-
private:
192-
// Return true if operation A properly dominates operation B. The
193-
/// 'enclosingOpOk' flag says whether we should return true if the b op is
194-
/// enclosed by a region on 'A'.
195-
bool properlyDominatesImpl(Operation *a, Operation *b,
196-
bool enclosingOpOk) const;
197188
};
198189

199190
/// A class for computing basic postdominance information.

mlir/lib/IR/Dominance.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ bool DominanceInfoBase<IsPostDom>::properlyDominates(Block *a, Block *b) const {
230230
if (regionA != b->getParent()) {
231231
b = regionA ? regionA->findAncestorBlockInRegion(*b) : nullptr;
232232
// If we could not find a valid block b then it is a not a dominator.
233-
if (b == nullptr)
233+
if (!b)
234234
return false;
235235

236236
// 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>;
266266
/// Return true if operation `a` properly dominates operation `b`. The
267267
/// 'enclosingOpOk' flag says whether we should return true if the `b` op is
268268
/// enclosed by a region on 'a'.
269-
bool DominanceInfo::properlyDominatesImpl(Operation *a, Operation *b,
270-
bool enclosingOpOk) const {
269+
bool DominanceInfo::properlyDominates(Operation *a, Operation *b,
270+
bool enclosingOpOk) const {
271271
Block *aBlock = a->getBlock(), *bBlock = b->getBlock();
272272
assert(aBlock && bBlock && "operations must be in a block");
273273

@@ -319,7 +319,7 @@ bool DominanceInfo::properlyDominates(Value a, Operation *b) const {
319319

320320
// `a` properlyDominates `b` if the operation defining `a` properlyDominates
321321
// `b`, but `a` does not itself enclose `b` in one of its regions.
322-
return properlyDominatesImpl(a.getDefiningOp(), b, /*enclosingOpOk=*/false);
322+
return properlyDominates(a.getDefiningOp(), b, /*enclosingOpOk=*/false);
323323
}
324324

325325
//===----------------------------------------------------------------------===//

0 commit comments

Comments
 (0)