[llvm-commits] [llvm] r153905 - /llvm/trunk/include/llvm/Analysis/Dominators.h
Rafael Espindola
rafael.espindola at gmail.com
Mon Apr 2 15:37:54 PDT 2012
Author: rafael
Date: Mon Apr 2 17:37:54 2012
New Revision: 153905
URL: http://llvm.org/viewvc/llvm-project?rev=153905&view=rev
Log:
Make dominatedBySlowTreeWalk private and assert cases handled by the caller.
Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=153905&r1=153904&r2=153905&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Apr 2 17:37:54 2012
@@ -185,6 +185,18 @@
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 @@
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 {
More information about the llvm-commits
mailing list