diff options
author | Devang Patel <dpatel@apple.com> | 2007-07-27 19:13:43 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-07-27 19:13:43 +0000 |
commit | 608ac7c88b1b83e4e69afabd010571151491feb0 (patch) | |
tree | 8354df96e28d9f8a309d8268d91d413b702e5c48 /lib/VMCore/Dominators.cpp | |
parent | d6605a8512d567beab56429e70bdc30062556930 (diff) | |
download | external_llvm-608ac7c88b1b83e4e69afabd010571151491feb0.zip external_llvm-608ac7c88b1b83e4e69afabd010571151491feb0.tar.gz external_llvm-608ac7c88b1b83e4e69afabd010571151491feb0.tar.bz2 |
Fix edge cases in handling basic block split.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40564 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Dominators.cpp')
-rw-r--r-- | lib/VMCore/Dominators.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lib/VMCore/Dominators.cpp b/lib/VMCore/Dominators.cpp index f8aef5d..9b5ee1b 100644 --- a/lib/VMCore/Dominators.cpp +++ b/lib/VMCore/Dominators.cpp @@ -616,7 +616,11 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) { PI != PE; ++PI) PredBlocks.push_back(*PI); - assert(!PredBlocks.empty() && "No predblocks??"); + if (PredBlocks.empty()) + // If NewBB does not have any predecessors then it is a entry block. + // In this case, NewBB and its successor NewBBSucc dominates all + // other blocks. + return; DominatorTree &DT = getAnalysis<DominatorTree>(); bool NewBBDominatesNewBBSucc = true; @@ -643,8 +647,13 @@ void DominanceFrontier::splitBlock(BasicBlock *NewBB) { else ++SetI; } - - addBasicBlock(NewBB, Set); + + DominanceFrontier::iterator NewBBI = find(NewBB); + if (NewBBI != end()) { + DominanceFrontier::DomSetType NewBBSet = NewBBI->second; + NewBBSet.insert(Set.begin(), Set.end()); + } else + addBasicBlock(NewBB, Set); } } else { |