<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Feb 7, 2018 at 10:28 AM Zachary Turner via Phabricator <<a href="mailto:reviews@reviews.llvm.org">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">zturner added a comment.<br>
<br>
In <a href="https://reviews.llvm.org/D43002#1000801" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43002#1000801</a>, @dblaikie wrote:<br>
<br>
> > It would be more efficient to put, e.g., a NamedMDNode into the module so this information can be shared between the CUs.<br>
><br>
> I assume the string data itself is shared by the bitcode format? But I don't really know.<br>
<br>
<br>
All of this code is new to me, so I'm still kind of fumbling along as I learn how all this stuff works together, </blockquote><div><br>Yeah, that question was more directed at Adrian.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">but my impression was that Adrian's suggestion only really applied if I wanted the name of the lto.o file.  Given that I need the name of the bitcode containing .o file, does any of this still apply?  Is the current solution appropriate in that case?<br></blockquote><div><br>Yeah, this issue still applies somewhat - Adrian mentioned the case of Swift producing multiple CUs even for a single swift file/object file. So arguably if the string data in each CU was stored separately, there might be some benefit to be gained by figuring out a way to share it between those CUs.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<br>
================<br>
Comment at: llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp:674-679<br>
+  for (unsigned i = 0; i != Str.size(); ++i) {<br>
+    if (Str[i] == '\\' && i != Str.size() - 1) {<br>
+      if (Str[i + 1] == '\\')<br>
+        Str.erase(Str.begin() + i + 1);<br>
+    }<br>
+  }<br>
----------------<br>
dblaikie wrote:<br>
> This is O(N^2) (erase is O(N)) & could be made O(N) (using a technique similar to the erase+remove idiom - using literal erase+remove probably isn't practical due to the stateful nature of the walk).<br>
><br>
> Is there no other logic for this already elsewhere in LLVM?<br>
Unfortunately there's not.  But you're right, I can do this a bit more efficiently by keeping a separate read pointer and write pointer.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D43002" rel="noreferrer" target="_blank">https://reviews.llvm.org/D43002</a><br>
<br>
<br>
<br>
</blockquote></div></div>