[llvm] r174084 - [Dwarf] early exit to avoid creating dangling DIEs
Eric Christopher
echristo at gmail.com
Thu Jan 31 13:02:38 PST 2013
Looks pretty good. How'd you find the failure? (dwarfdump --verify?)
I'd really appreciate if you could try to reduce down a testcase.
Thanks
-eric
On Thu, Jan 31, 2013 at 12:05 PM, Manman Ren <mren at apple.com> wrote:
> Author: mren
> Date: Thu Jan 31 14:05:14 2013
> New Revision: 174084
>
> URL: http://llvm.org/viewvc/llvm-project?rev=174084&view=rev
> Log:
> [Dwarf] early exit to avoid creating dangling DIEs
>
> We used to create children DIEs for a scope, then check whether ScopeDIE is
> null. If ScopeDIE is null, the children DIEs will be dangling. Other DIEs
> can
> link to those dangling DIEs, which are not emitted at all, causing dwarf
> error.
>
> The current testing case is 4k lines, from
> MultiSource/BenchMark/McCat/09-vor.
>
> rdar://problem/13071959
>
> Modified:
> llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
>
> Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=174084&r1=174083&r2=174084&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
> +++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jan 31 14:05:14
> 2013
> @@ -540,6 +540,12 @@ DIE *DwarfDebug::constructScopeDIE(Compi
> if (!Scope || !Scope->getScopeNode())
> return NULL;
>
> + DIScope DS(Scope->getScopeNode());
> + // Early return to avoid creating dangling variable|scope DIEs.
> + if (!Scope->getInlinedAt() && DS.isSubprogram() &&
> Scope->isAbstractScope() &&
> + !TheCU->getDIE(DS))
> + return NULL;
> +
> SmallVector<DIE *, 8> Children;
> DIE *ObjectPointer = NULL;
>
> @@ -565,7 +571,6 @@ DIE *DwarfDebug::constructScopeDIE(Compi
> for (unsigned j = 0, M = Scopes.size(); j < M; ++j)
> if (DIE *Nested = constructScopeDIE(TheCU, Scopes[j]))
> Children.push_back(Nested);
> - DIScope DS(Scope->getScopeNode());
> DIE *ScopeDIE = NULL;
> if (Scope->getInlinedAt())
> ScopeDIE = constructInlinedScopeDIE(TheCU, Scope);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130131/02addfe1/attachment.html>
More information about the llvm-commits
mailing list