[llvm] r328189 - [CloneFunction] Preserve DT in DuplicateInstructionsInSplitBetween.

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 22 04:38:54 PDT 2018


Author: fhahn
Date: Thu Mar 22 04:38:53 2018
New Revision: 328189

URL: http://llvm.org/viewvc/llvm-project?rev=328189&view=rev
Log:
[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

Modified:
    llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
    llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp

Modified: llvm/trunk/include/llvm/Transforms/Utils/Cloning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Transforms/Utils/Cloning.h?rev=328189&r1=328188&r2=328189&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Transforms/Utils/Cloning.h (original)
+++ llvm/trunk/include/llvm/Transforms/Utils/Cloning.h Thu Mar 22 04:38:53 2018
@@ -265,7 +265,8 @@ void remapInstructionsInBlocks(const Sma
 BasicBlock *
 DuplicateInstructionsInSplitBetween(BasicBlock *BB, BasicBlock *PredBB,
                                     Instruction *StopAt,
-                                    ValueToValueMapTy &ValueMapping);
+                                    ValueToValueMapTy &ValueMapping,
+                                    DominatorTree *DT = nullptr);
 } // end namespace llvm
 
 #endif // LLVM_TRANSFORMS_UTILS_CLONING_H

Modified: llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp?rev=328189&r1=328188&r2=328189&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/CloneFunction.cpp Thu Mar 22 04:38:53 2018
@@ -797,7 +797,8 @@ Loop *llvm::cloneLoopWithPreheader(Basic
 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.
@@ -805,7 +806,7 @@ llvm::DuplicateInstructionsInSplitBetwee
   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();
 




More information about the llvm-commits mailing list