aboutsummaryrefslogtreecommitdiff
path: root/include/llvm/Analysis/Dominators.h
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2009-06-03 21:42:06 +0000
committerEli Friedman <eli.friedman@gmail.com>2009-06-03 21:42:06 +0000
commita8ba2c25e9ea7b0d213b485debe5d044efde66a4 (patch)
treed9b1d22cf0d2bf1cae1b79dc87c7273a9daac35f /include/llvm/Analysis/Dominators.h
parent77648cfd7546b47db0dc7d454e127c96ab39941b (diff)
PR4317: Handle splits where the new block is unreachable correctly in
DominatorTreeBase::Split. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72810 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Analysis/Dominators.h')
-rw-r--r--include/llvm/Analysis/Dominators.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/llvm/Analysis/Dominators.h b/include/llvm/Analysis/Dominators.h
index b405f5b71e..347e239d8e 100644
--- a/include/llvm/Analysis/Dominators.h
+++ b/include/llvm/Analysis/Dominators.h
@@ -270,12 +270,17 @@ protected:
NewBBIDom = PredBlocks[i];
break;
}
- assert(i != PredBlocks.size() && "No reachable preds?");
+
+ // It's possible that none of the predecessors of NewBB are reachable;
+ // in that case, NewBB itself is unreachable, so nothing needs to be
+ // changed.
+ if (!NewBBIDom)
+ return;
+
for (i = i + 1; i < PredBlocks.size(); ++i) {
if (DT.isReachableFromEntry(PredBlocks[i]))
NewBBIDom = DT.findNearestCommonDominator(NewBBIDom, PredBlocks[i]);
}
- assert(NewBBIDom && "No immediate dominator found??");
// Create the new dominator tree node... and set the idom of NewBB.
DomTreeNodeBase<NodeT> *NewBBNode = DT.addNewBlock(NewBB, NewBBIDom);