Do not lose line number info while eliminating tail call.
authorDevang Patel <dpatel@apple.com>
Thu, 28 Apr 2011 18:43:39 +0000 (18:43 +0000)
committerDevang Patel <dpatel@apple.com>
Thu, 28 Apr 2011 18:43:39 +0000 (18:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@130419 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/TailRecursionElimination.cpp

index a2217597100b6db278200d65314d166838814162..539cc6f0baf50471ef854c4c723acd0521bb25e2 100644 (file)
@@ -573,7 +573,9 @@ bool TailCallElim::EliminateRecursiveTailCall(CallInst *CI, ReturnInst *Ret,
 
   // Now that all of the PHI nodes are in place, remove the call and
   // ret instructions, replacing them with an unconditional branch.
-  BranchInst::Create(OldEntry, Ret);
+  BranchInst *NewBI = BranchInst::Create(OldEntry, Ret);
+  NewBI->setDebugLoc(CI->getDebugLoc());
+
   BB->getInstList().erase(Ret);  // Remove return.
   BB->getInstList().erase(CI);   // Remove call.
   ++NumEliminated;