Skip to content

Commit a95b212

Browse files
authored
[DWARF] Don't search scope chain to find DISubprogram for prologues (#107261)
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 3413f95 commit a95b212

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
@@ -2198,11 +2198,10 @@ DebugLoc DwarfDebug::emitInitialLocDirective(const MachineFunction &MF,
21982198

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

0 commit comments

Comments
 (0)