forked from OSchip/llvm-project
[CloneFunction] Preserve DT in DuplicateInstructionsInSplitBetween.
DuplicateInstructionsInSplitBetween can preserve the DT by passing through DT to SplitEdge. Reviewers: sanjoy, junbuml, anna, kuhar Reviewed By: kuhar Differential Revision: https://reviews.llvm.org/D44629 llvm-svn: 328189
This commit is contained in:
parent
7e69dd02bb
commit
3bb822e7d6
|
@ -265,7 +265,8 @@ void remapInstructionsInBlocks(const SmallVectorImpl<BasicBlock *> &Blocks,
|
||||||
BasicBlock *
|
BasicBlock *
|
||||||
DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
|
DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
|
||||||
Instruction *StopAt,
|
Instruction *StopAt,
|
||||||
ValueToValueMapTy &ValueMapping);
|
ValueToValueMapTy &ValueMapping,
|
||||||
|
DominatorTree *DT = nullptr);
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
|
||||||
#endif // LLVM_TRANSFORMS_UTILS_CLONING_H
|
#endif // LLVM_TRANSFORMS_UTILS_CLONING_H
|
||||||
|
|
|
@ -797,7 +797,8 @@ Loop *llvm::cloneLoopWithPreheader(BasicBlock *Before, BasicBlock *LoopDomBB,
|
||||||
BasicBlock *
|
BasicBlock *
|
||||||
llvm::DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
|
llvm::DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
|
||||||
Instruction *StopAt,
|
Instruction *StopAt,
|
||||||
ValueToValueMapTy &ValueMapping) {
|
ValueToValueMapTy &ValueMapping,
|
||||||
|
DominatorTree *DT) {
|
||||||
// We are going to have to map operands from the original BB block to the new
|
// We are going to have to map operands from the original BB block to the new
|
||||||
// copy of the block 'NewBB'. If there are PHI nodes in BB, evaluate them to
|
// copy of the block 'NewBB'. If there are PHI nodes in BB, evaluate them to
|
||||||
// account for entry from PredBB.
|
// account for entry from PredBB.
|
||||||
|
@ -805,7 +806,7 @@ llvm::DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
|
||||||
for (; PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
|
for (; PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
|
||||||
ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB);
|
ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB);
|
||||||
|
|
||||||
BasicBlock *NewBB = SplitEdge(PredBB, BB);
|
BasicBlock *NewBB = SplitEdge(PredBB, BB, DT);
|
||||||
NewBB->setName(PredBB->getName() + ".split");
|
NewBB->setName(PredBB->getName() + ".split");
|
||||||
Instruction *NewTerm = NewBB->getTerminator();
|
Instruction *NewTerm = NewBB->getTerminator();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue