mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-05 14:34:55 +00:00
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138449 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
c7e0bb2325
commit
605e2b5184
@ -299,16 +299,17 @@ 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);
|
||||
std::vector<DomTreeNode *> Children;
|
||||
for (DomTreeNode::iterator I = OldNode->begin(), E = OldNode->end();
|
||||
I != E; ++I)
|
||||
Children.push_back(*I);
|
||||
if (DomTreeNode *OldNode = DT->getNode(Old)) {
|
||||
std::vector<DomTreeNode *> Children;
|
||||
for (DomTreeNode::iterator I = OldNode->begin(), E = OldNode->end();
|
||||
I != E; ++I)
|
||||
Children.push_back(*I);
|
||||
|
||||
DomTreeNode *NewNode = DT->addNewBlock(New,Old);
|
||||
for (std::vector<DomTreeNode *>::iterator I = Children.begin(),
|
||||
E = Children.end(); I != E; ++I)
|
||||
DT->changeImmediateDominator(*I, NewNode);
|
||||
}
|
||||
}
|
||||
|
||||
return New;
|
||||
|
Loading…
x
Reference in New Issue
Block a user