[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Aug 1 15:25:03 PDT 2006
Changes in directory llvm/lib/VMCore:
Dominators.cpp updated: 1.71 -> 1.72
---
Log message:
Add dominates/properlyDominates queries to IDom.
---
Diffs of the changes: (+11 -0)
Dominators.cpp | 11 +++++++++++
1 files changed, 11 insertions(+)
Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.71 llvm/lib/VMCore/Dominators.cpp:1.72
--- llvm/lib/VMCore/Dominators.cpp:1.71 Wed Jun 7 17:00:26 2006
+++ llvm/lib/VMCore/Dominators.cpp Tue Aug 1 17:24:47 2006
@@ -211,6 +211,17 @@
return false;
}
+/// dominates - Return true if A dominates B.
+///
+bool ImmediateDominatorsBase::dominates(BasicBlock *A, BasicBlock *B) const {
+ assert(A && B && "Null pointers?");
+
+ // Walk up the dominator tree from B to determine if A dom B.
+ while (A != B && B)
+ B = get(B);
+ return A == B;
+}
+
void ImmediateDominatorsBase::print(std::ostream &o, const Module* ) const {
Function *F = getRoots()[0]->getParent();
for (Function::iterator I = F->begin(), E = F->end(); I != E; ++I) {
More information about the llvm-commits
mailing list