[llvm] 251958f - [DebugInfo] Don't pick prologue_end if there are no instructions
Jeremy Morse via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 14 05:42:14 PST 2024
Author: Jeremy Morse
Date: 2024-11-14T13:41:50Z
New Revision: 251958f3570730f58d1337ac6d00f03ee6a839fe
URL: https://github.com/llvm/llvm-project/commit/251958f3570730f58d1337ac6d00f03ee6a839fe
DIFF: https://github.com/llvm/llvm-project/commit/251958f3570730f58d1337ac6d00f03ee6a839fe.diff
LOG: [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.
Added:
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 4604adf9d2d3d0..affc72b5950fd9 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2277,6 +2277,10 @@ static void recordSourceLine(AsmPrinter &Asm, unsigned Line, unsigned Col,
const MachineInstr *
DwarfDebug::emitInitialLocDirective(const MachineFunction &MF, unsigned CUID) {
+ // Don't deal with functions that have no instructions.
+ if (llvm::all_of(MF, [](const MachineBasicBlock &MBB) { return MBB.empty(); }))
+ return nullptr;
+
std::pair<const MachineInstr *, bool> PrologEnd = findPrologueEndLoc(&MF);
const MachineInstr *PrologEndLoc = PrologEnd.first;
bool IsEmptyPrologue = PrologEnd.second;
More information about the llvm-commits
mailing list