[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
Wed Apr 6 23:07:45 PDT 2016
> On 2016-Apr-06, at 17:09, Adrian Prantl <aprantl at apple.com> wrote:
>
> aprantl added a comment.
>
> Ping.
>
>
> http://reviews.llvm.org/D18477
There's something I don't quite understand in the DwarfDebug.cpp which
I point out below. Heading out on vacation, so I'm happy to defer to
Eric/David/you/etc. if it makes sense (LGTM once others are happy).
> Index: lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> ===================================================================
> --- lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> +++ lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> @@ -527,29 +527,10 @@
>
> void DwarfDebug::finishSubprogramDefinitions() {
> for (const auto &P : SPMap)
> - forBothCUs(*P.second, [&](DwarfCompileUnit &CU) {
> - CU.finishSubprogramDefinition(cast<DISubprogram>(P.first));
> - });
> -}
> -
> -// Collect info for variables that were optimized out.
> -void DwarfDebug::collectDeadVariables() {
> - const Module *M = MMI->getModule();
> -
> - if (NamedMDNode *CU_Nodes = M->getNamedMetadata("llvm.dbg.cu")) {
> - for (MDNode *N : CU_Nodes->operands()) {
> - auto *TheCU = cast<DICompileUnit>(N);
> - // Construct subprogram DIE and add variables DIEs.
> - DwarfCompileUnit *SPCU =
> - static_cast<DwarfCompileUnit *>(CUMap.lookup(TheCU));
> - assert(SPCU && "Unable to find Compile Unit!");
> - for (auto *SP : TheCU->getSubprograms()) {
> - if (ProcessedSPNodes.count(SP) != 0)
> - continue;
> - SPCU->collectDeadVariables(SP);
> - }
> - }
> - }
> + if (ProcessedSPNodes.count(P.first))
> + forBothCUs(*P.second, [&](DwarfCompileUnit &CU) {
> + CU.finishSubprogramDefinition(cast<DISubprogram>(P.first));
> + });
^ remember this...
> }
>
> void DwarfDebug::finalizeModuleInfo() {
> @@ -559,9 +540,6 @@
>
> finishVariableDefinitions();
>
> - // Collect info for variables that were optimized out.
> - collectDeadVariables();
> -
> // Handle anything that needs to be done on a per-unit basis after
> // all other generation.
> for (const auto &P : CUMap) {
> @@ -1121,6 +1099,10 @@
> PrevCU = nullptr;
> CurFn = nullptr;
> DebugHandlerBase::endFunction(MF);
> + // Mark functions with no debug info on any instructions, but a
> + // valid DISubprogram as processed.
> + if (auto *SP = MF->getFunction()->getSubprogram())
> + ProcessedSPNodes.insert(SP);
Why do you want to run the above code for these subprograms?
Don't you want to skip them entirely?
> return;
> }
>
>
More information about the llvm-commits
mailing list