-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[DWARF] Don't search scope chain to find DISubprogram for prologues #107261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Seemingly this goes back to fd07a2a in 2015 -- I anticipate that back then the metadata layout was radically different. But nowadays at least, we can just directly look up the subprogram.
@llvm/pr-subscribers-debuginfo Author: Jeremy Morse (jmorse) ChangesDespite having a DISubprogram to hand, this code calls Nowadays at least, we can just directly look up the subprogram (and I'd like to refactor this area a little). Full diff: https://github.com/llvm/llvm-project/pull/107261.diff 1 Files Affected:
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index f111b4aea06f1b..1d57b5e4400dc2 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2199,11 +2199,10 @@ DebugLoc DwarfDebug::emitInitialLocDirective(const MachineFunction &MF,
// Ensure the compile unit is created if the function is called before
// beginFunction().
- (void)getOrCreateDwarfCompileUnit(
- MF.getFunction().getSubprogram()->getUnit());
+ DISubprogram *SP = MF.getFunction().getSubprogram();
+ (void)getOrCreateDwarfCompileUnit(SP->getUnit());
// We'd like to list the prologue as "not statements" but GDB behaves
// poorly if we do that. Revisit this with caution/GDB (7.5+) testing.
- const DISubprogram *SP = PrologEndLoc->getInlinedAtScope()->getSubprogram();
::recordSourceLine(*Asm, SP->getScopeLine(), 0, SP, DWARF2_FLAG_IS_STMT,
CUID, getDwarfVersion(), getUnits());
return PrologEndLoc;
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/73/builds/5002 Here is the relevant piece of the build log for the reference
|
Despite having a DISubprogram to hand, this code calls
getInlinedAtScope
to step through all inlined scopes to the outermost one and retrieve... the same DISubprogram. Seemingly this goes back to fd07a2a in 2015 -- I anticipate that back then the metadata layout was radically different, and the code simply hasn't been changed since then as it isn't broken.Nowadays at least, we can just directly look up the subprogram (and I'd like to refactor this area a little).