mirror of
https://github.com/RPCS3/llvm.git
synced 2025-04-04 22:31:44 +00:00
When extracting SEME regions of code, the extractor needs to update the dominator tree for split return blocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79957 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
838dbd92d8
commit
9ea9fcdf65
@ -183,8 +183,24 @@ void CodeExtractor::severSplitPHINodes(BasicBlock *&Header) {
|
|||||||
void CodeExtractor::splitReturnBlocks() {
|
void CodeExtractor::splitReturnBlocks() {
|
||||||
for (std::set<BasicBlock*>::iterator I = BlocksToExtract.begin(),
|
for (std::set<BasicBlock*>::iterator I = BlocksToExtract.begin(),
|
||||||
E = BlocksToExtract.end(); I != E; ++I)
|
E = BlocksToExtract.end(); I != E; ++I)
|
||||||
if (ReturnInst *RI = dyn_cast<ReturnInst>((*I)->getTerminator()))
|
if (ReturnInst *RI = dyn_cast<ReturnInst>((*I)->getTerminator())) {
|
||||||
(*I)->splitBasicBlock(RI, (*I)->getName()+".ret");
|
BasicBlock *New = (*I)->splitBasicBlock(RI, (*I)->getName()+".ret");
|
||||||
|
if (DT) {
|
||||||
|
// Old dominates New. New node domiantes all other nodes dominated
|
||||||
|
//by Old.
|
||||||
|
DomTreeNode *OldNode = DT->getNode(*I);
|
||||||
|
std::vector<DomTreeNode *> Children;
|
||||||
|
for (DomTreeNode::iterator DI = OldNode->begin(), DE = OldNode->end();
|
||||||
|
DI != DE; ++DI)
|
||||||
|
Children.push_back(*DI);
|
||||||
|
|
||||||
|
DomTreeNode *NewNode = DT->addNewBlock(New, *I);
|
||||||
|
|
||||||
|
for (std::vector<DomTreeNode *>::iterator I = Children.begin(),
|
||||||
|
E = Children.end(); I != E; ++I)
|
||||||
|
DT->changeImmediateDominator(*I, NewNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// findInputsOutputs - Find inputs to, outputs from the code region.
|
// findInputsOutputs - Find inputs to, outputs from the code region.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user