Fix a crashing bug in SplitBlock when it is called on a block with no
dominator information even though dominators were previously computed. Patch by Nick Sumner. llvm-svn: 138449
This commit is contained in:
parent
a281f2d07d
commit
d3e65e702f
|
@ -299,7 +299,7 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
|
|||
|
||||
if (DominatorTree *DT = P->getAnalysisIfAvailable<DominatorTree>()) {
|
||||
// Old dominates New. New node dominates all other nodes dominated by Old.
|
||||
DomTreeNode *OldNode = DT->getNode(Old);
|
||||
if (DomTreeNode *OldNode = DT->getNode(Old)) {
|
||||
std::vector<DomTreeNode *> Children;
|
||||
for (DomTreeNode::iterator I = OldNode->begin(), E = OldNode->end();
|
||||
I != E; ++I)
|
||||
|
@ -310,6 +310,7 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
|
|||
E = Children.end(); I != E; ++I)
|
||||
DT->changeImmediateDominator(*I, NewNode);
|
||||
}
|
||||
}
|
||||
|
||||
return New;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue