[llvm-commits] [llvm] r82490 - in /llvm/trunk: include/llvm/Analysis/Dominators.h lib/VMCore/Dominators.cpp

Chris Lattner sabre at nondot.org
Mon Sep 21 17:30:50 CDT 2009


Author: lattner
Date: Mon Sep 21 17:30:50 2009
New Revision: 82490

URL: http://llvm.org/viewvc/llvm-project?rev=82490&view=rev
Log:
move DominatorTree::dominates for instructions out of line,
no functionality change.

Modified:
    llvm/trunk/include/llvm/Analysis/Dominators.h
    llvm/trunk/lib/VMCore/Dominators.cpp

Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=82490&r1=82489&r2=82490&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Sep 21 17:30:50 2009
@@ -748,34 +748,13 @@
 
   // dominates - Return true if A dominates B. This performs the
   // special checks necessary if A and B are in the same basic block.
-  bool dominates(const Instruction *A, const Instruction *B) const {
-    const BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
-    if (BBA != BBB) return dominates(BBA, BBB);
-
-    // It is not possible to determine dominance between two PHI nodes 
-    // based on their ordering.
-    if (isa<PHINode>(A) && isa<PHINode>(B)) 
-      return false;
-
-    // Loop through the basic block until we find A or B.
-    BasicBlock::const_iterator I = BBA->begin();
-    for (; &*I != A && &*I != B; ++I) /*empty*/;
-
-    //if(!DT.IsPostDominators) {
-      // A dominates B if it is found first in the basic block.
-      return &*I == A;
-    //} else {
-    //  // A post-dominates B if B is found first in the basic block.
-    //  return &*I == B;
-    //}
-  }
+  bool dominates(const Instruction *A, const Instruction *B) const;
 
-  inline bool properlyDominates(const DomTreeNode* A,
-                                const DomTreeNode* B) const {
+  bool properlyDominates(const DomTreeNode *A, const DomTreeNode *B) const {
     return DT->properlyDominates(A, B);
   }
 
-  inline bool properlyDominates(BasicBlock* A, BasicBlock* B) const {
+  bool properlyDominates(BasicBlock *A, BasicBlock *B) const {
     return DT->properlyDominates(A, B);
   }
 

Modified: llvm/trunk/lib/VMCore/Dominators.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Dominators.cpp?rev=82490&r1=82489&r2=82490&view=diff

==============================================================================
--- llvm/trunk/lib/VMCore/Dominators.cpp (original)
+++ llvm/trunk/lib/VMCore/Dominators.cpp Mon Sep 21 17:30:50 2009
@@ -52,6 +52,25 @@
   DT->print(OS);
 }
 
+// dominates - Return true if A dominates B. This performs the
+// special checks necessary if A and B are in the same basic block.
+bool DominatorTree::dominates(const Instruction *A, const Instruction *B) const{
+  const BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
+  if (BBA != BBB) return dominates(BBA, BBB);
+  
+  // It is not possible to determine dominance between two PHI nodes 
+  // based on their ordering.
+  if (isa<PHINode>(A) && isa<PHINode>(B)) 
+    return false;
+  
+  // Loop through the basic block until we find A or B.
+  BasicBlock::const_iterator I = BBA->begin();
+  for (; &*I != A && &*I != B; ++I)
+    /*empty*/;
+  
+  return &*I == A;
+}
+
 
 
 //===----------------------------------------------------------------------===//





More information about the llvm-commits mailing list