[llvm] [Debuginfo][TailCallElim] Fix #86262: drop the debug location of entry branch (PR #86269)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 07:21:28 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();
----------------
SLTozer wrote:
```suggestion
// 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.
```
I appreciate the code-as-documentation approach, but since this is guaranteed to be a no-op it's probably better to just leave the comment here - that should be explicit enough.
https://github.com/llvm/llvm-project/pull/86269
More information about the llvm-commits
mailing list