summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
diff options
context:
space:
mode:
authorAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-08-03 20:27:13 +0000
committerAnastasis Grammenos <anastasis.gramm2@gmail.com>2018-08-03 20:27:13 +0000
commit4dfe279e00d56f23c37a526b3abe0a7c89269fa7 (patch)
treea08e638a3fc43e5602fe7fc3824ef1db428ade72 /llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
parentbde9cf942b7c914b3774424d41b771c44d2d71e4 (diff)
downloadbcm5719-llvm-4dfe279e00d56f23c37a526b3abe0a7c89269fa7.tar.gz
bcm5719-llvm-4dfe279e00d56f23c37a526b3abe0a7c89269fa7.zip
[TRE][DebugInfo] Preserve Debug Location in new branch instruction
There are two branch instructions created so the new test covers them both. Differential Revision: https://reviews.llvm.org/D50263 llvm-svn: 338917
Diffstat (limited to 'llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
index f8cd6c17a5a..818e8373b1c 100644
--- a/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -566,7 +566,8 @@ static bool eliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
BasicBlock *NewEntry = BasicBlock::Create(F->getContext(), "", F, OldEntry);
NewEntry->takeName(OldEntry);
OldEntry->setName("tailrecurse");
- BranchInst::Create(OldEntry, NewEntry);
+ BranchInst *BI = BranchInst::Create(OldEntry, NewEntry);
+ BI->setDebugLoc(CI->getDebugLoc());
// If this tail call is marked 'tail' and if there are any allocas in the
// entry block, move them up to the new entry block.
OpenPOWER on IntegriCloud