aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/Analysis
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2007-08-17 21:59:16 +0000
committerDevang Patel <dpatel@apple.com>2007-08-17 21:59:16 +0000
commit9cee7a0d8e6a38a15b611f35432e2a3cd550fa24 (patch)
treebe25bf6cf25aae8fdc046f23c8aeabc6eaf31d6d /include/llvm/Analysis
parent51ce038ef93efb5ddb3f5b51552212ab8d1470b2 (diff)
downloadexternal_llvm-9cee7a0d8e6a38a15b611f35432e2a3cd550fa24.zip
external_llvm-9cee7a0d8e6a38a15b611f35432e2a3cd550fa24.tar.gz
external_llvm-9cee7a0d8e6a38a15b611f35432e2a3cd550fa24.tar.bz2
When one branch of condition is eliminated then head of the other
branch is not necessary immediate dominators of merge blcok in all cases. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41144 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis')
-rw-r--r--include/llvm/Analysis/Dominators.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index 41e6938..ec6a67b 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -438,6 +438,26 @@ public:
/// frontier to reflect this change.
void splitBlock(BasicBlock *BB);
+ /// BasicBlock BB's new dominator is NewBB. Update BB's dominance frontier
+ /// to reflect this change.
+ void changeImmediateDominator(BasicBlock *BB, BasicBlock *NewBB,
+ DominatorTree *DT) {
+ // NewBB is now dominating BB. Which means BB's dominance
+ // frontier is now part of NewBB's dominance frontier. However, BB
+ // itself is not member of NewBB's dominance frontier.
+ DominanceFrontier::iterator NewDFI = find(NewBB);
+ DominanceFrontier::iterator DFI = find(BB);
+ DominanceFrontier::DomSetType BBSet = DFI->second;
+ for (DominanceFrontier::DomSetType::iterator BBSetI = BBSet.begin(),
+ BBSetE = BBSet.end(); BBSetI != BBSetE; ++BBSetI) {
+ BasicBlock *DFMember = *BBSetI;
+ // Insert only if NewBB dominates DFMember.
+ if (!DT->dominates(NewBB, DFMember))
+ NewDFI->second.insert(DFMember);
+ }
+ NewDFI->second.erase(BB);
+ }
+
private:
const DomSetType &calculate(const DominatorTree &DT,
const DomTreeNode *Node);