Skip to content

Commit 251958f

Browse files
committed
[DebugInfo] Don't pick prologue_end if there are no instructions
Add a filter to avoid picking prologue_end when a function is empty (it may have blocks but no instructions). This saves us from pushing more validity-checking into findPrologueEndLoc.
1 parent b96c24b commit 251958f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2277,6 +2277,10 @@ static void recordSourceLine(AsmPrinter &Asm, unsigned Line, unsigned Col,
22772277

22782278
const MachineInstr *
22792279
DwarfDebug::emitInitialLocDirective(const MachineFunction &MF, unsigned CUID) {
2280+
// Don't deal with functions that have no instructions.
2281+
if (llvm::all_of(MF, [](const MachineBasicBlock &MBB) { return MBB.empty(); }))
2282+
return nullptr;
2283+
22802284
std::pair<const MachineInstr *, bool> PrologEnd = findPrologueEndLoc(&MF);
22812285
const MachineInstr *PrologEndLoc = PrologEnd.first;
22822286
bool IsEmptyPrologue = PrologEnd.second;

0 commit comments

Comments
 (0)