[llvm] [Debuginfo][TailCallElim] Fix #86262: drop the debug location of entry branch (PR #86269)

Shan Huang via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 07:51:05 PDT 2024


================
@@ -510,7 +510,11 @@ void TailRecursionEliminator::createTailRecurseLoopHeader(CallInst *CI) {
   NewEntry->takeName(HeaderBB);
   HeaderBB->setName("tailrecurse");
   BranchInst *BI = BranchInst::Create(HeaderBB, NewEntry);
-  BI->setDebugLoc(CI->getDebugLoc());
+  // If the new branch preserves the debug location of CI, it could result in
+  // misleading stepping, if CI is located in a conditional branch.
+  // So, here we don't give any debug location to BI, and use dropLocation()
+  // to explicitly present this dicision.
+  BI->dropLocation();
----------------
Apochens wrote:

Ok, that looks more suitable.

https://github.com/llvm/llvm-project/pull/86269


More information about the llvm-commits mailing list