[llvm-commits] CVS: llvm/lib/VMCore/Dominators.cpp
Devang Patel
dpatel at apple.com
Tue Mar 20 13:18:34 PDT 2007
Changes in directory llvm/lib/VMCore:
Dominators.cpp updated: 1.78 -> 1.79
---
Log message:
LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.
---
Diffs of the changes: (+19 -0)
Dominators.cpp | 19 +++++++++++++++++++
1 files changed, 19 insertions(+)
Index: llvm/lib/VMCore/Dominators.cpp
diff -u llvm/lib/VMCore/Dominators.cpp:1.78 llvm/lib/VMCore/Dominators.cpp:1.79
--- llvm/lib/VMCore/Dominators.cpp:1.78 Fri Nov 17 02:03:48 2006
+++ llvm/lib/VMCore/Dominators.cpp Tue Mar 20 15:18:12 2007
@@ -883,6 +883,25 @@
DFSInfoValid = true;
}
+// dominates - Return true if A dominates B. THis performs the
+// special checks necessary if A and B are in the same basic block.
+bool ETForestBase::dominates(Instruction *A, Instruction *B) {
+ BasicBlock *BBA = A->getParent(), *BBB = B->getParent();
+ if (BBA != BBB) return dominates(BBA, BBB);
+
+ // Loop through the basic block until we find A or B.
+ BasicBlock::iterator I = BBA->begin();
+ for (; &*I != A && &*I != B; ++I) /*empty*/;
+
+ 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;
+ }
+}
+
ETNode *ETForest::getNodeForBlock(BasicBlock *BB) {
ETNode *&BBNode = Nodes[BB];
if (BBNode) return BBNode;
More information about the llvm-commits
mailing list