<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 10, 2017 at 12:06 PM Jonas Devlieghere <<a href="mailto:jdevlieghere@apple.com">jdevlieghere@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><br><blockquote type="cite"><div>On Oct 10, 2017, at 6:24 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:</div><br class="m_-8536887263197915193Apple-interchange-newline"><div><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Tue, Oct 10, 2017 at 10:06 AM Jonas Devlieghere via Phabricator <<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">JDevlieghere marked 2 inline comments as done.<br>
JDevlieghere added inline comments.<br>
<br>
<br>
================<br>
Comment at: lib/DebugInfo/DWARF/DWARFVerifier.cpp:423<br>
+    // Make sure specification and abstract origin have compatible tag.<br>
+    if (auto Offset = AttrValue.Value.getAsReference()) {<br>
+<br>
----------------<br>
dblaikie wrote:<br>
> Can you use DWARFDie::getAttributeValueAsReferencedDie here, perhaps?<br>
Unfortunately not, because this makes use of `getUnitForOffset` which in turn uses a list of units that isn't build when doing the verification.<br></blockquote><div><br>Not sure I understand - this code calls getDIEForOffset, which calls getUnitForOffset as well. So why would one path be usable and the other not?<br></div></div></div></div></blockquote><div><br></div></div></div><div style="word-wrap:break-word;line-break:after-white-space"><div><div>I would have to double check with the code in front of me, but it uses an upper_bound to find the right unit based on the offset, and this code path doesn’t populate that list. I noticed this earlier when I was trying to understand why the name of the subroutine is shown when dumping the debug info but not when running the verifier. I think this is the result of only considering one unit at a time when verifying, but I didn’t dig much deeper once I had found the explanation. </div></div></div></blockquote><div><br>Yeah, I'm really not understanding the difference between these possible codepaths.<br><br>The code in this review calls:<br><br>  auto Offset = AttrValue.Value.getAsReference()<br>  DCtx.getDIEForOffset(*Offset)<br>  ->CUs.getUnitForOffset(*Offset)->getDIEForOffset(*Offset);<br><br>the code in DWARFDie::getAttributeValueAsReferencedDie calls:<br><br>  auto SpecRef = toReference(find(Attr));<br>  U->getUnitSection().getUnitForOffset(*SpecRef)->getDIEForOffset(*SpecRef);<br><br>(where 'getUnitSection' returns DWARFUnitSectionBase, and 'CUs' is a DWARFUnitSectionBase (well, a class derived from it, DWARFUnitSection<DWARFCompileUnit>)<br><br>So I'm really having a hard time understanding why these codepaths would be different & it seems subtle/worth fixing if they are.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space"><div><br><blockquote type="cite"><div><div dir="ltr"><div class="gmail_quote"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Furthermore, this is (probably) slightly more efficient as we already have the attribute value and therefore do not need to do any indirections via the abbrev declaration.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D38719" rel="noreferrer" target="_blank">https://reviews.llvm.org/D38719</a><br>
<br>
<br>
<br>
</blockquote></div></div>
</div></blockquote></div></div></blockquote></div></div>