Skip to content

Commit b2f79f6

Browse files
[GenericDomTree][NFC] Remove unnecessary const_casts
1 parent 4c63672 commit b2f79f6

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

llvm/include/llvm/Support/GenericDomTree.h

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ class DominatorTreeBase {
419419
bool isReachableFromEntry(const NodeT *A) const {
420420
assert(!this->isPostDominator() &&
421421
"This is not implemented for post dominators");
422-
return isReachableFromEntry(getNode(const_cast<NodeT *>(A)));
422+
return isReachableFromEntry(getNode(A));
423423
}
424424

425425
bool isReachableFromEntry(const DomTreeNodeBase<NodeT> *A) const { return A; }
@@ -939,23 +939,15 @@ bool DominatorTreeBase<NodeT, IsPostDom>::dominates(const NodeT *A,
939939
if (A == B)
940940
return true;
941941

942-
// Cast away the const qualifiers here. This is ok since
943-
// this function doesn't actually return the values returned
944-
// from getNode.
945-
return dominates(getNode(const_cast<NodeT *>(A)),
946-
getNode(const_cast<NodeT *>(B)));
942+
return dominates(getNode(A), getNode(B));
947943
}
948944
template <typename NodeT, bool IsPostDom>
949945
bool DominatorTreeBase<NodeT, IsPostDom>::properlyDominates(
950946
const NodeT *A, const NodeT *B) const {
951947
if (A == B)
952948
return false;
953949

954-
// Cast away the const qualifiers here. This is ok since
955-
// this function doesn't actually return the values returned
956-
// from getNode.
957-
return dominates(getNode(const_cast<NodeT *>(A)),
958-
getNode(const_cast<NodeT *>(B)));
950+
return dominates(getNode(A), getNode(B));
959951
}
960952

961953
} // end namespace llvm

0 commit comments

Comments
 (0)