diff options
Diffstat (limited to 'llvm/lib/Transforms/Utils/CloneFunction.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index 9387797..3555064 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -607,7 +607,9 @@ void PruningFunctionCloner::CloneBlock( // Constant fold to uncond branch! if (Cond) { BasicBlock *Dest = BI->getSuccessor(!Cond->getZExtValue()); - VMap[OldTI] = BranchInst::Create(Dest, NewBB); + auto *NewBI = BranchInst::Create(Dest, NewBB); + NewBI->setDebugLoc(BI->getDebugLoc()); + VMap[OldTI] = NewBI; ToClone.push_back(Dest); TerminatorDone = true; } @@ -622,7 +624,9 @@ void PruningFunctionCloner::CloneBlock( if (Cond) { // Constant fold to uncond branch! SwitchInst::ConstCaseHandle Case = *SI->findCaseValue(Cond); BasicBlock *Dest = const_cast<BasicBlock *>(Case.getCaseSuccessor()); - VMap[OldTI] = BranchInst::Create(Dest, NewBB); + auto *NewBI = BranchInst::Create(Dest, NewBB); + NewBI->setDebugLoc(SI->getDebugLoc()); + VMap[OldTI] = NewBI; ToClone.push_back(Dest); TerminatorDone = true; } |