aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/InlineFunction.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-05-07 11:54:57 +0100
committerGitHub <noreply@github.com>2025-05-07 11:54:57 +0100
commit5be080edf73abd9d980ced8a432aaf2861d4445e (patch)
treedda0d6a0092d4f722e059e4c2965c2ba2f647966 /llvm/lib/Transforms/Utils/InlineFunction.cpp
parent2fb288d4b8e0fb6c08a1a72b64cbf6a0752fdac7 (diff)
downloadllvm-5be080edf73abd9d980ced8a432aaf2861d4445e.zip
llvm-5be080edf73abd9d980ced8a432aaf2861d4445e.tar.gz
llvm-5be080edf73abd9d980ced8a432aaf2861d4445e.tar.bz2
[KeyInstr][Inline] Don't propagate atoms to inlined nodebug instructions (#133485)
RFC: https://discourse.llvm.org/t/rfc-improving-is-stmt-placement-for-better-interactive-debugging/82668
Diffstat (limited to 'llvm/lib/Transforms/Utils/InlineFunction.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/InlineFunction.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index eaf57e7..2412146 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1827,10 +1827,16 @@ static DebugLoc inlineDebugLoc(DebugLoc OrigDL, DILocation *InlinedAt,
/// to encode location where these instructions are inlined.
static void fixupLineNumbers(Function *Fn, Function::iterator FI,
Instruction *TheCall, bool CalleeHasDebugInfo) {
- const DebugLoc &TheCallDL = TheCall->getDebugLoc();
- if (!TheCallDL)
+ if (!TheCall->getDebugLoc())
return;
+ // Don't propagate the source location atom from the call to inlined nodebug
+ // instructions, and avoid putting it in the InlinedAt field of inlined
+ // not-nodebug instructions. FIXME: Possibly worth transferring/generating
+ // an atom for the returned value, otherwise we miss stepping on inlined
+ // nodebug functions (which is different to existing behaviour).
+ DebugLoc TheCallDL = TheCall->getDebugLoc().get()->getWithoutAtom();
+
auto &Ctx = Fn->getContext();
DILocation *InlinedAtNode = TheCallDL;