[PATCH] D44629: [CloneFunction] Preserve DT in DuplicateInstructionsInSplitBetween.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 19 08:33:47 PDT 2018
fhahn created this revision.
fhahn added reviewers: sanjoy, junbuml, anna.
fhahn added a dependent revision: D43173: [CallSiteSplitting] Preserve DominatorTreeAnalysis..
DuplicateInstructionsInSplitBetween can preserve the DT by passing
through DT to SplitEdge.
https://reviews.llvm.org/D44629
Files:
include/llvm/Transforms/Utils/Cloning.h
lib/Transforms/Utils/CloneFunction.cpp
Index: lib/Transforms/Utils/CloneFunction.cpp
===================================================================
--- lib/Transforms/Utils/CloneFunction.cpp
+++ lib/Transforms/Utils/CloneFunction.cpp
@@ -797,15 +797,16 @@
BasicBlock *
llvm::DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
Instruction *StopAt,
- ValueToValueMapTy &ValueMapping) {
+ ValueToValueMapTy &ValueMapping,
+ DominatorTree *DT) {
// 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
// account for entry from PredBB.
BasicBlock::iterator BI = BB->begin();
for (; PHINode *PN = dyn_cast<PHINode>(BI); ++BI)
ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB);
- BasicBlock *NewBB = SplitEdge(PredBB, BB);
+ BasicBlock *NewBB = SplitEdge(PredBB, BB, DT);
NewBB->setName(PredBB->getName() + ".split");
Instruction *NewTerm = NewBB->getTerminator();
Index: include/llvm/Transforms/Utils/Cloning.h
===================================================================
--- include/llvm/Transforms/Utils/Cloning.h
+++ include/llvm/Transforms/Utils/Cloning.h
@@ -265,7 +265,8 @@
BasicBlock *
DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
Instruction *StopAt,
- ValueToValueMapTy &ValueMapping);
+ ValueToValueMapTy &ValueMapping,
+ DominatorTree *DT = nullptr);
} // end namespace llvm
#endif // LLVM_TRANSFORMS_UTILS_CLONING_H
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44629.138939.patch
Type: text/x-patch
Size: 1798 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180319/2be67cf2/attachment.bin>
More information about the llvm-commits
mailing list