diff options
author | Devang Patel <dpatel@apple.com> | 2007-03-20 20:18:12 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-03-20 20:18:12 +0000 |
commit | 3b57b6f36e906d69cc578f3e2f72dcd263a72a30 (patch) | |
tree | b208611bc4f1a4fc4f5452bc986f36d35d36140e /lib/VMCore/Dominators.cpp | |
parent | a0a26b7454ae6e7a729b4a47ee1b1e37c7c71858 (diff) | |
download | external_llvm-3b57b6f36e906d69cc578f3e2f72dcd263a72a30.zip external_llvm-3b57b6f36e906d69cc578f3e2f72dcd263a72a30.tar.gz external_llvm-3b57b6f36e906d69cc578f3e2f72dcd263a72a30.tar.bz2 |
LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35221 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Dominators.cpp')
-rw-r--r-- | lib/VMCore/Dominators.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index 3a6721a..f760706 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -883,6 +883,25 @@ void ETForestBase::updateDFSNumbers() 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; |