[PATCH] D14623: [ThinLTO] Comdat importing fixes and related cleanup

Teresa Johnson via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 12 11:41:46 PST 2015


tejohnson created this revision.
tejohnson added reviewers: rafael, dexonsmith.
tejohnson added subscribers: llvm-commits, davidxl, joker.eph.

A number of comdat related fixes, cleanup and test cases.

I made a number of changes to get importing working when there are
comdats, with lots of new test cases involving comdats of various
selection types, linkage types, with and without aliases.

The changes ensure we link in the full comdat group containing the
function indicated for importing. Previously I intended to require
that the importer specify the additional comdat group members for
importing on successive importing requests. However, in order to get the
comdat selection type correct it is significantly simpler to import the
full comdat group in a single pass.

Additionally, if the module linker selects the source version of a
comdat not containing the imported function, if it is referenced
by an imported function we also import all its comdat group member
definitions (via the lazy linker) in the same importing pass.
In order to support this, we are now much more aggressive about lazy
linking global values during importing, which only need to be
linked in (as either declarations or definitions) if referenced by an
imported function.

Also, because we may now import additional function bodies lazily, it is
no longer possible to determine up front whether an alias's aliasee is
going to be imported as a definition or not when we copy its prototype.
Therefore, we now convert aliases into declarations after all lazy
linking is complete, if the aliasee definition was not imported.

Finally, since comdat members may not be declarations (including
available_externally), after linking is complete those that were
imported as linker declarations will be removed from comdats.

http://reviews.llvm.org/D14623

Files:
  lib/Linker/LinkModules.cpp
  test/Linker/Inputs/funcimport_comdat.ll
  test/Linker/Inputs/funcimport_comdat2.ll
  test/Linker/Inputs/funcimport_comdat3.ll
  test/Linker/funcimport.ll
  test/Linker/funcimport_comdat.ll
  test/Linker/funcimport_comdat2.ll
  test/Linker/funcimport_comdat3.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D14623.40076.patch
Type: text/x-patch
Size: 27790 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151112/375c3e35/attachment.bin>


More information about the llvm-commits mailing list