Skip to content

[mlir][IR][NFC] DominanceInfo: Minor code cleanups #115430

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions mlir/include/mlir/IR/Dominance.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions mlir/lib/IR/Dominance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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);
}

//===----------------------------------------------------------------------===//
Expand Down
Loading