<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 12, 2015 at 12:56 PM, David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, Nov 12, 2015 at 11:41 AM, Teresa Johnson 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">tejohnson created this revision.<br>
tejohnson added reviewers: rafael, dexonsmith.<br>
tejohnson added subscribers: llvm-commits, davidxl, joker.eph.<br>
<br>
A number of comdat related fixes, cleanup and test cases.<br>
<br>
I made a number of changes to get importing working when there are<br>
comdats, with lots of new test cases involving comdats of various<br>
selection types, linkage types, with and without aliases.<br>
<br>
The changes ensure we link in the full comdat group containing the<br>
function indicated for importing. Previously I intended to require<br>
that the importer specify the additional comdat group members for<br>
importing on successive importing requests. However, in order to get the<br>
comdat selection type correct it is significantly simpler to import the<br>
full comdat group in a single pass.<br></blockquote><div><br></div></span><div>I thought all imported definitions were marked available_externally - in which case I'm not sure why it would be necessary to bring in the whole comdat group, since the comdat would never be emitted here.<br></div></div></div></div></blockquote><div><br></div><div>That is not the case -- there is no guarantee that the comdat defs are available externally.</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br>I guess I'm missing something - is there a pointer to when/why this is necessary?<br><br>(& in fact, it might be useful to have this pass make one instance of a comdat group into an external definition (I guess that's probably not possible unless you have true whole program knowledge - maybe there's another linkage type which would produce the comdat group even if all the calls are optimized away) - and mark all the other instances available_externally? even potentially stripping the comdat groups from modules where the call sites are really cold)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
<br>
Additionally, if the module linker selects the source version of a<br>
comdat not containing the imported function, if it is referenced<br>
by an imported function we also import all its comdat group member<br>
definitions (via the lazy linker) in the same importing pass.<br>
In order to support this, we are now much more aggressive about lazy<br>
linking global values during importing, which only need to be<br>
linked in (as either declarations or definitions) if referenced by an<br>
imported function.<br>
<br>
Also, because we may now import additional function bodies lazily, it is<br>
no longer possible to determine up front whether an alias's aliasee is<br>
going to be imported as a definition or not when we copy its prototype.<br>
Therefore, we now convert aliases into declarations after all lazy<br>
linking is complete, if the aliasee definition was not imported.<br>
<br>
Finally, since comdat members may not be declarations (including<br>
available_externally), after linking is complete those that were<br>
imported as linker declarations will be removed from comdats.<br>
<br>
<a href="http://reviews.llvm.org/D14623" rel="noreferrer" target="_blank">http://reviews.llvm.org/D14623</a><br>
<br>
Files:<br>
  lib/Linker/LinkModules.cpp<br>
  test/Linker/Inputs/funcimport_comdat.ll<br>
  test/Linker/Inputs/funcimport_comdat2.ll<br>
  test/Linker/Inputs/funcimport_comdat3.ll<br>
  test/Linker/funcimport.ll<br>
  test/Linker/funcimport_comdat.ll<br>
  test/Linker/funcimport_comdat2.ll<br>
  test/Linker/funcimport_comdat3.ll<br>
<br>
<br></div></div>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">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>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>