<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div><br></div>Yes, I found the failure by "dwarfdump --verify". I tried to reduce the test case manually, but didn't succeed.<div>bugpoint does not reduce the metadata.</div><div><br><div>I will try harder.</div><div><br></div><div>Thanks,</div><div>Manman</div></div><div><br></div><div><div>On Jan 31, 2013, at 1:02 PM, Eric Christopher <<a href="mailto:echristo@gmail.com">echristo@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Looks pretty good. How'd you find the failure? (dwarfdump --verify?)<div><br></div><div>I'd really appreciate if you could try to reduce down a testcase.</div><div><br></div><div style="">Thanks</div><div style="">
<br></div><div style="">-eric</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 31, 2013 at 12:05 PM, Manman Ren <span dir="ltr"><<a href="mailto:mren@apple.com" target="_blank">mren@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: mren<br>
Date: Thu Jan 31 14:05:14 2013<br>
New Revision: 174084<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=174084&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=174084&view=rev</a><br>
Log:<br>
[Dwarf] early exit to avoid creating dangling DIEs<br>
<br>
We used to create children DIEs for a scope, then check whether ScopeDIE is<br>
null. If ScopeDIE is null, the children DIEs will be dangling. Other DIEs can<br>
link to those dangling DIEs, which are not emitted at all, causing dwarf error.<br>
<br>
The current testing case is 4k lines, from MultiSource/BenchMark/McCat/09-vor.<br>
<br>
<a href="rdar://problem/13071959">rdar://problem/13071959</a><br>
<br>
Modified:<br>
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
<br>
Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=174084&r1=174083&r2=174084&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=174084&r1=174083&r2=174084&view=diff</a><br>

==============================================================================<br>
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)<br>
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jan 31 14:05:14 2013<br>
@@ -540,6 +540,12 @@ DIE *DwarfDebug::constructScopeDIE(Compi<br>
   if (!Scope || !Scope->getScopeNode())<br>
     return NULL;<br>
<br>
+  DIScope DS(Scope->getScopeNode());<br>
+  // Early return to avoid creating dangling variable|scope DIEs.<br>
+  if (!Scope->getInlinedAt() && DS.isSubprogram() && Scope->isAbstractScope() &&<br>
+      !TheCU->getDIE(DS))<br>
+    return NULL;<br>
+<br>
   SmallVector<DIE *, 8> Children;<br>
   DIE *ObjectPointer = NULL;<br>
<br>
@@ -565,7 +571,6 @@ DIE *DwarfDebug::constructScopeDIE(Compi<br>
   for (unsigned j = 0, M = Scopes.size(); j < M; ++j)<br>
     if (DIE *Nested = constructScopeDIE(TheCU, Scopes[j]))<br>
       Children.push_back(Nested);<br>
-  DIScope DS(Scope->getScopeNode());<br>
   DIE *ScopeDIE = NULL;<br>
   if (Scope->getInlinedAt())<br>
     ScopeDIE = constructInlinedScopeDIE(TheCU, Scope);<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></body></html>