<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, May 21, 2016 at 2:16 AM, George Rimar via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">grimar added inline comments.<br>
<span class=""><br>
================<br>
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:626<br>
@@ +625,3 @@<br>
+  if (Is64Bit)<br>
+    Extractor.getUnsigned(&Offset, sizeof(Elf64_Word));<br>
+<br>
----------------<br>
</span><span class="">dblaikie wrote:<br>
> You could just increment Offset (by sizeof(Elf64_Word)) here, I think?<br>
</span>Right.<br>
<span class=""><br>
================<br>
Comment at: lib/DebugInfo/DWARF/DWARFContext.cpp:681-685<br>
@@ -639,10 +680,7 @@<br>
+    if (ZLibStyleCompressed || name.startswith("zdebug_")) {<br>
+      SmallString<32> Out;<br>
+      if (!tryDecompress(name, data, Out, ZLibStyleCompressed, IsLittleEndian,<br>
+                         AddressSize == 8))<br>
         continue;<br>
-      UncompressedSections.resize(UncompressedSections.size() + 1);<br>
-      if (zlib::uncompress(data, UncompressedSections.back(), OriginalSize) !=<br>
-          zlib::StatusOK) {<br>
-        UncompressedSections.pop_back();<br>
-        continue;<br>
-      }<br>
-      // Make data point to uncompressed section contents and save its contents.<br>
-      name = name.substr(1);<br>
+      UncompressedSections.emplace_back(Out);<br>
       data = UncompressedSections.back();<br>
----------------<br>
</span><span class="">dblaikie wrote:<br>
> This involves making extra copies of the data. Is there a reason you went with this over the original code that decompressed straight into the UncompressedSections?<br>
</span>My point was to avoid possible calls of pop_back right after resize if decompression fails.<br>
That should be rare case (I think decompression fail is infrequent, except cases of disabled zlib (now check for that is inside tryDecompress)), but code itself looks bit overcomplicated.<br>
<br>
I just forgot to use std::move() to avoid extras when rewrote. Fixed. There should be no more extra heap allocations here.<br></blockquote><div><br></div><div>Except this defeats/comes at a cost of the small vector optimization - std::move on a small vector in small mode is the same as a copy.<br><br>Sorry, perhaps I should've commented the original code to explain/justify it better.<br><br>- David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="http://reviews.llvm.org/D20470" rel="noreferrer" target="_blank">http://reviews.llvm.org/D20470</a><br>
<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</div></div></blockquote></div><br></div></div>