[llvm] [GenericDomTree][NFC] Remove unnecessary `const_cast`s (PR #97638)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 3 14:14:59 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-support
Author: None (MagentaTreehouse)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/97638.diff
1 Files Affected:
- (modified) llvm/include/llvm/Support/GenericDomTree.h (+3-11)
``````````diff
diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h
index a8e178d6461e0..08ada7b5c43e3 100644
--- a/llvm/include/llvm/Support/GenericDomTree.h
+++ b/llvm/include/llvm/Support/GenericDomTree.h
@@ -419,7 +419,7 @@ class DominatorTreeBase {
bool isReachableFromEntry(const NodeT *A) const {
assert(!this->isPostDominator() &&
"This is not implemented for post dominators");
- return isReachableFromEntry(getNode(const_cast<NodeT *>(A)));
+ return isReachableFromEntry(getNode(A));
}
bool isReachableFromEntry(const DomTreeNodeBase<NodeT> *A) const { return A; }
@@ -939,11 +939,7 @@ bool DominatorTreeBase<NodeT, IsPostDom>::dominates(const NodeT *A,
if (A == B)
return true;
- // Cast away the const qualifiers here. This is ok since
- // this function doesn't actually return the values returned
- // from getNode.
- return dominates(getNode(const_cast<NodeT *>(A)),
- getNode(const_cast<NodeT *>(B)));
+ return dominates(getNode(A), getNode(B));
}
template <typename NodeT, bool IsPostDom>
bool DominatorTreeBase<NodeT, IsPostDom>::properlyDominates(
@@ -951,11 +947,7 @@ bool DominatorTreeBase<NodeT, IsPostDom>::properlyDominates(
if (A == B)
return false;
- // Cast away the const qualifiers here. This is ok since
- // this function doesn't actually return the values returned
- // from getNode.
- return dominates(getNode(const_cast<NodeT *>(A)),
- getNode(const_cast<NodeT *>(B)));
+ return dominates(getNode(A), getNode(B));
}
} // end namespace llvm
``````````
</details>
https://github.com/llvm/llvm-project/pull/97638
More information about the llvm-commits
mailing list