[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Apr 25 13:50:49 PDT 2005



Changes in directory llvm/lib/VMCore:

Dominators.cpp updated: 1.62 -> 1.63
---
Log message:

Make dominates(A,B) work with post dominators.  Patch contributed by
Naveen Neelakantam, thanks!


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

 Dominators.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)


Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.62 llvm/lib/VMCore/Dominators.cpp:1.63
--- llvm/lib/VMCore/Dominators.cpp:1.62	Sat Apr 23 16:38:35 2005
+++ llvm/lib/VMCore/Dominators.cpp	Mon Apr 25 15:50:33 2005
@@ -245,8 +245,13 @@
   BasicBlock::iterator I = BBA->begin();
   for (; &*I != A && &*I != B; ++I) /*empty*/;
 
-  // A dominates B if it is found first in the basic block...
-  return &*I == A;
+  if(!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;
+  }
 }
 
 






More information about the llvm-commits mailing list