diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2012-04-02 22:37:54 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2012-04-02 22:37:54 +0000 |
commit | 1c8cf21d0c96cee0d55b619be58b1b400675e6ac (patch) | |
tree | 2781b3d7bd6087fa3d2ee5fa37a60666bfd97379 /include/llvm/Analysis/Dominators.h | |
parent | e3b23cde80b19507f1d8b641a541e91ace0864dc (diff) | |
download | llvm-1c8cf21d0c96cee0d55b619be58b1b400675e6ac.tar.gz llvm-1c8cf21d0c96cee0d55b619be58b1b400675e6ac.tar.bz2 llvm-1c8cf21d0c96cee0d55b619be58b1b400675e6ac.tar.xz |
Make dominatedBySlowTreeWalk private and assert cases handled by the caller.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153905 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r-- | include/llvm/Analysis/Dominators.h | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h index 6a2db8a775..372465a054 100644 --- a/include/llvm/Analysis/Dominators.h +++ b/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 { |