diff options
Diffstat (limited to 'llvm/lib/Transforms/Scalar/JumpThreading.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/JumpThreading.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 31f6f38..1d5d7cc 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -2699,6 +2699,9 @@ bool JumpThreadingPass::duplicateCondBranchOnPHIIntoPred( // PredBB block. Evaluate PHI nodes in BB. ValueToValueMapTy ValueMapping; + // Remember the position before the inserted instructions. + auto RItBeforeInsertPt = std::next(OldPredBranch->getReverseIterator()); + BasicBlock::iterator BI = BB->begin(); for (; PHINode *PN = dyn_cast<PHINode>(BI); ++BI) ValueMapping[PN] = PN->getIncomingValueForBlock(PredBB); @@ -2718,6 +2721,8 @@ bool JumpThreadingPass::duplicateCondBranchOnPHIIntoPred( // Remap debug variable operands. remapDebugVariable(ValueMapping, New); + if (const DebugLoc &DL = New->getDebugLoc()) + mapAtomInstance(DL, ValueMapping); // If this instruction can be simplified after the operands are updated, // just use the simplified value instead. This frequently happens due to @@ -2756,6 +2761,10 @@ bool JumpThreadingPass::duplicateCondBranchOnPHIIntoPred( addPHINodeEntriesForMappedBlock(BBBranch->getSuccessor(1), BB, PredBB, ValueMapping); + // KeyInstructions: Remap the cloned instructions' atoms only. + remapSourceAtoms(ValueMapping, std::prev(RItBeforeInsertPt)->getIterator(), + OldPredBranch->getIterator()); + updateSSA(BB, PredBB, ValueMapping); // PredBB no longer jumps to BB, remove entries in the PHI node for the edge |