summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2012-04-02 22:37:54 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2012-04-02 22:37:54 +0000
commitf76bff0504c0182185af31e8e02da73d06e19736 (patch)
treefa0d9385fe081d1346e1b947c9e3eb026be3f36e
parent291007b055b15ce2432f132cbcbd602fb349ebf8 (diff)
downloadbcm5719-llvm-f76bff0504c0182185af31e8e02da73d06e19736.tar.gz
bcm5719-llvm-f76bff0504c0182185af31e8e02da73d06e19736.zip
Make dominatedBySlowTreeWalk private and assert cases handled by the caller.
llvm-svn: 153905
-rw-r--r--llvm/include/llvm/Analysis/Dominators.h33
1 files changed, 12 insertions, 21 deletions
diff --git a/llvm/include/llvm/Analysis/Dominators.h b/llvm/include/llvm/Analysis/Dominators.h
index 6a2db8a775d..372465a0544 100644
--- a/llvm/include/llvm/Analysis/Dominators.h
+++ b/llvm/include/llvm/Analysis/Dominators.h
@@ -185,6 +185,18 @@ void Calculate(DominatorTreeBase<typename GraphTraits<N>::NodeType>& DT,
template<class NodeT>
class DominatorTreeBase : public DominatorBase<NodeT> {
+ bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A,
+ const DomTreeNodeBase<NodeT> *B) const {
+ assert(A != B);
+ assert(isReachableFromEntry(B));
+ assert(isReachableFromEntry(A));
+
+ const DomTreeNodeBase<NodeT> *IDom;
+ while ((IDom = B->getIDom()) != 0 && IDom != A && IDom != B)
+ B = IDom; // Walk up the tree
+ return IDom != 0;
+ }
+
protected:
typedef DenseMap<NodeT*, DomTreeNodeBase<NodeT>*> DomTreeNodeMapType;
DomTreeNodeMapType DomTreeNodes;
@@ -348,27 +360,6 @@ public:
bool properlyDominates(const NodeT *A, const NodeT *B);
- bool dominatedBySlowTreeWalk(const DomTreeNodeBase<NodeT> *A,
- const DomTreeNodeBase<NodeT> *B) const {
- // A node trivially dominates itself.
- if (B == A)
- return true;
-
- // An unreachable node is dominated by anything.
- if (!isReachableFromEntry(B))
- return true;
-
- // And dominates nothing.
- if (!isReachableFromEntry(A))
- return false;
-
- const DomTreeNodeBase<NodeT> *IDom;
- while ((IDom = B->getIDom()) != 0 && IDom != A && IDom != B)
- B = IDom; // Walk up the tree
- return IDom != 0;
- }
-
-
/// isReachableFromEntry - Return true if A is dominated by the entry
/// block of the function containing it.
bool isReachableFromEntry(const NodeT* A) const {
OpenPOWER on IntegriCloud