Skip to content

Commit 60750e7

Browse files
committed
[DebugInfo] Don't search scope chain to find Subprogram
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.
1 parent 56152fa commit 60750e7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,11 +2199,10 @@ DebugLoc DwarfDebug::emitInitialLocDirective(const MachineFunction &MF,
21992199

22002200
// Ensure the compile unit is created if the function is called before
22012201
// beginFunction().
2202-
(void)getOrCreateDwarfCompileUnit(
2203-
MF.getFunction().getSubprogram()->getUnit());
2202+
DISubprogram *SP = MF.getFunction().getSubprogram();
2203+
(void)getOrCreateDwarfCompileUnit(SP->getUnit());
22042204
// We'd like to list the prologue as "not statements" but GDB behaves
22052205
// poorly if we do that. Revisit this with caution/GDB (7.5+) testing.
2206-
const DISubprogram *SP = PrologEndLoc->getInlinedAtScope()->getSubprogram();
22072206
::recordSourceLine(*Asm, SP->getScopeLine(), 0, SP, DWARF2_FLAG_IS_STMT,
22082207
CUID, getDwarfVersion(), getUnits());
22092208
return PrologEndLoc;

0 commit comments

Comments
 (0)