[PATCH] D18477: Drop debug info for DISubprograms that are not referenced by anything

Duncan P. N. Exon Smith via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 25 11:23:03 PDT 2016


> On 2016-Mar-25, at 10:32, David Blaikie <dblaikie at gmail.com> wrote:
> 
> dblaikie added a comment.
> 
> Any particular benefit of doing this before doing the remapping from subprogram->cu? (I guess it means doing some of the test case cleanup first, and the change is pretty small - but we'll want to remove those code changes once the remapping is done, right?)
> 
> 
> ================
> Comment at: lib/CodeGen/AsmPrinter/DwarfDebug.cpp:530
> @@ -529,4 +529,3 @@
>   for (const auto &P : SPMap)
> -    forBothCUs(*P.second, [&](DwarfCompileUnit &CU) {
> -      CU.finishSubprogramDefinition(cast<DISubprogram>(P.first));
> -    });
> +    if (ProcessedSPNodes.count(P.first) != 0)
> +      forBothCUs(*P.second, [&](DwarfCompileUnit &CU) {
> ----------------
> This is usually just written without the != 0
> 
> ================
> Comment at: test/DebugInfo/X86/debug-dead-local-var.ll:14-16
> @@ -13,5 +13,8 @@
> 
> -; Check that we still have the structure type for X even though we're not
> -; going to emit a low/high_pc for foo.
> -; CHECK: DW_TAG_structure_type
> 
> ----------------
> Have you checked the commit history for this? It looks pretty deliberate, and while I suspect even if it was we probably still want to make the change you're making - but it'd be good to check the historic reasoning, etc.
> 
> 
> Repository:
>  rL LLVM
> 
> http://reviews.llvm.org/D18477

This is spirtual revert of r107027, so it was deliberate... Adrian and
I looked at the history internally and it doesn't seem relevant anymore.

> Index: lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
> @@ -706,6 +706,10 @@
>    DIE *SPDIE = DU->getAbstractSPDies().lookup(SP);
>    if (!SPDIE)
>      SPDIE = getDIE(SP);
> +  // Don't do this if the function is not referenced by either an
> +  // abstract scope or an llvm::Function.
> +  if (!SPDIE)
> +    return;
>    assert(SPDIE);
>    for (const DILocalVariable *DV : Variables) {
>      DbgVariable NewVar(DV, /* IA */ nullptr, DD);

Can we just delete this function entirely?  I think collectDeadVariables
might be effectively dead.


More information about the llvm-commits mailing list