[PATCH] D50263: [TRE][DebugInfo] Preserve Debug Location in new branch instruction
Anastasis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 3 13:27:52 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338917: [TRE][DebugInfo] Preserve Debug Location in new branch instruction (authored by gramanas, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D50263
Files:
llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
llvm/trunk/test/Transforms/TailCallElim/debugloc.ll
Index: llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
===================================================================
--- llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
+++ llvm/trunk/lib/Transforms/Scalar/TailRecursionElimination.cpp
@@ -566,7 +566,8 @@
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.
Index: llvm/trunk/test/Transforms/TailCallElim/debugloc.ll
===================================================================
--- llvm/trunk/test/Transforms/TailCallElim/debugloc.ll
+++ llvm/trunk/test/Transforms/TailCallElim/debugloc.ll
@@ -0,0 +1,16 @@
+; RUN: opt < %s -debugify -tailcallelim -S | FileCheck %s
+
+define void @foo() {
+entry:
+; CHECK-LABEL: entry:
+; CHECK: br label %tailrecurse, !dbg ![[DbgLoc:[0-9]+]]
+
+ call void @foo() ;; line 1
+ ret void
+
+; CHECK-LABEL: tailrecurse:
+; CHECK: br label %tailrecurse, !dbg ![[DbgLoc]]
+}
+
+;; Make sure tailrecurse has the call instruction's DL
+; CHECK: ![[DbgLoc]] = !DILocation(line: 1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50263.159078.patch
Type: text/x-patch
Size: 1416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180803/be169ac1/attachment.bin>
More information about the llvm-commits
mailing list