[llvm] r174084 - [Dwarf] early exit to avoid creating dangling DIEs

Manman Ren mren at apple.com
Thu Jan 31 13:23:43 PST 2013


Yes, I found the failure by "dwarfdump --verify". I tried to reduce the test case manually, but didn't succeed.
bugpoint does not reduce the metadata.

I will try harder.

Thanks,
Manman

On Jan 31, 2013, at 1:02 PM, Eric Christopher <echristo at gmail.com> wrote:

> 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/84d38cc8/attachment.html>


More information about the llvm-commits mailing list