Skip to content

Commit 254ba78

Browse files
[GenericDomTree][NFC] Remove unnecessary const_casts (#97638)
1 parent 01b9638 commit 254ba78

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
@@ -456,7 +456,7 @@ class DominatorTreeBase {
456456
bool isReachableFromEntry(const NodeT *A) const {
457457
assert(!this->isPostDominator() &&
458458
"This is not implemented for post dominators");
459-
return isReachableFromEntry(getNode(const_cast<NodeT *>(A)));
459+
return isReachableFromEntry(getNode(A));
460460
}
461461

462462
bool isReachableFromEntry(const DomTreeNodeBase<NodeT> *A) const { return A; }
@@ -1014,23 +1014,15 @@ bool DominatorTreeBase<NodeT, IsPostDom>::dominates(const NodeT *A,
10141014
if (A == B)
10151015
return true;
10161016

1017-
// Cast away the const qualifiers here. This is ok since
1018-
// this function doesn't actually return the values returned
1019-
// from getNode.
1020-
return dominates(getNode(const_cast<NodeT *>(A)),
1021-
getNode(const_cast<NodeT *>(B)));
1017+
return dominates(getNode(A), getNode(B));
10221018
}
10231019
template <typename NodeT, bool IsPostDom>
10241020
bool DominatorTreeBase<NodeT, IsPostDom>::properlyDominates(
10251021
const NodeT *A, const NodeT *B) const {
10261022
if (A == B)
10271023
return false;
10281024

1029-
// Cast away the const qualifiers here. This is ok since
1030-
// this function doesn't actually return the values returned
1031-
// from getNode.
1032-
return dominates(getNode(const_cast<NodeT *>(A)),
1033-
getNode(const_cast<NodeT *>(B)));
1025+
return dominates(getNode(A), getNode(B));
10341026
}
10351027

10361028
} // end namespace llvm

0 commit comments

Comments
 (0)