[llvm-commits] CVS: llvm/include/llvm/Analysis/Dominators.h

Devang Patel dpatel at apple.com
Thu Jun 7 11:40:02 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

Dominators.h updated: 1.93 -> 1.94
---
Log message:

Add BasicBlock level dominates(A,B) interface.


---
Diffs of the changes:  (+14 -2)

 Dominators.h |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)


Index: llvm/include/llvm/Analysis/Dominators.h
diff -u llvm/include/llvm/Analysis/Dominators.h:1.93 llvm/include/llvm/Analysis/Dominators.h:1.94
--- llvm/include/llvm/Analysis/Dominators.h:1.93	Thu Jun  7 12:47:21 2007
+++ llvm/include/llvm/Analysis/Dominators.h	Thu Jun  7 13:39:40 2007
@@ -170,11 +170,16 @@
   }
 
   void updateDFSNumbers();  
+
   /// dominates - Returns true iff this dominates N.  Note that this is not a
   /// constant time operation!
   ///
   inline bool dominates(const DomTreeNode *A, DomTreeNode *B) {
-    if (B == A) return true;  // A node trivially dominates itself.
+    if (B == A) 
+      return true;  // A node trivially dominates itself.
+
+    if (A == 0 || B == 0)
+      return false;
 
     ETNode *NodeA = A->getETNode();
     ETNode *NodeB = B->getETNode();
@@ -192,7 +197,14 @@
     //return NodeB->DominatedBySlow(NodeA);
     return dominatedBySlowTreeWalk(A, B);
   }
-  
+
+  inline bool dominates(BasicBlock *A, BasicBlock *B) {
+    if (A == B) 
+      return true;
+    
+    return dominates(getNode(A), getNode(B));
+  }
+
   //===--------------------------------------------------------------------===//
   // API to update (Post)DominatorTree information based on modifications to
   // the CFG...






More information about the llvm-commits mailing list