mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
After a basic block is split into two parts,
second part dominates all the blocks dominated by original basic block. And first part dominates second part. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40035 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
72ea8d9060
commit
a8a8a36629
@ -165,8 +165,21 @@ BasicBlock *llvm::SplitBlock(BasicBlock *Old, Instruction *SplitPt, Pass *P) {
|
||||
if (Loop *L = LI.getLoopFor(Old))
|
||||
L->addBasicBlockToLoop(New, LI);
|
||||
|
||||
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>())
|
||||
DT->addNewBlock(New, Old);
|
||||
if (DominatorTree *DT = P->getAnalysisToUpdate<DominatorTree>())
|
||||
{
|
||||
// Old dominates New. New node domiantes 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);
|
||||
|
||||
DomTreeNode *NewNode = DT->addNewBlock(New,Old);
|
||||
|
||||
for (std::vector<DomTreeNode *>::iterator I = Children.begin(),
|
||||
E = Children.end(); I != E; ++I)
|
||||
DT->changeImmediateDominator(*I, NewNode);
|
||||
}
|
||||
|
||||
if (DominanceFrontier *DF = P->getAnalysisToUpdate<DominanceFrontier>())
|
||||
DF->splitBlock(Old);
|
||||
|
Loading…
x
Reference in New Issue
Block a user