llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-backend-x86 Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> I assume getSubprogram will do the correct thing in hasDebugInfo, and this is redundant with the debug_compile_units distance check. This is in preparation for removing the field. --- Full diff: https://github.com/llvm/llvm-project/pull/100333.diff 2 Files Affected: - (modified) llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp (+3-6) - (modified) llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (+4-3) ``````````diff diff --git a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp index 6c70c47de8822..ed99eb3c459e5 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DebugHandlerBase.cpp @@ -241,10 +241,7 @@ bool DebugHandlerBase::isUnsignedDIType(const DIType *Ty) { Ty->getTag() == dwarf::DW_TAG_unspecified_type; } -static bool hasDebugInfo(const MachineModuleInfo *MMI, - const MachineFunction *MF) { - if (!MMI->hasDebugInfo()) - return false; +static bool hasDebugInfo(const MachineFunction *MF) { auto *SP = MF->getFunction().getSubprogram(); if (!SP) return false; @@ -258,7 +255,7 @@ static bool hasDebugInfo(const MachineModuleInfo *MMI, void DebugHandlerBase::beginFunction(const MachineFunction *MF) { PrevInstBB = nullptr; - if (!Asm || !hasDebugInfo(MMI, MF)) { + if (!Asm || !hasDebugInfo(MF)) { skippedNonDebugFunction(); return; } @@ -415,7 +412,7 @@ void DebugHandlerBase::endInstruction() { } void DebugHandlerBase::endFunction(const MachineFunction *MF) { - if (Asm && hasDebugInfo(MMI, MF)) + if (Asm && hasDebugInfo(MF)) endFunctionImpl(MF); DbgValues.clear(); DbgLabels.clear(); diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 5f1f315c5ab24..fbce7e92b7781 100644 --- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -1148,14 +1148,15 @@ sortGlobalExprs(SmallVectorImpl<DwarfCompileUnit::GlobalExpr> &GVEs) { void DwarfDebug::beginModule(Module *M) { DebugHandlerBase::beginModule(M); - if (!Asm || !MMI->hasDebugInfo()) + if (!Asm) return; unsigned NumDebugCUs = std::distance(M->debug_compile_units_begin(), M->debug_compile_units_end()); + if (NumDebugCUs == 0) + return; + assert(NumDebugCUs > 0 && "Asm unexpectedly initialized"); - assert(MMI->hasDebugInfo() && - "DebugInfoAvailabilty unexpectedly not initialized"); SingleCU = NumDebugCUs == 1; DenseMap<DIGlobalVariable *, SmallVector<DwarfCompileUnit::GlobalExpr, 1>> GVMap; `````````` </details> https://github.com/llvm/llvm-project/pull/100333 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits