[PATCH] D29509: [ThinLTO] Import linkonce_odr as available_externally when possible

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 3 12:57:28 PST 2017


tejohnson created this revision.
Herald added a subscriber: Prazek.

We no longer force import linkonce_odr on reference, so the comment was
wrong. And now that we do linkonce/weak resolution, we don't are
guaranteed to have an externally available copy elsewhere.

[ThinLTO] Import linkonce_odr as available_externally

We no longer need to import linkonce_odr as linkonce_odr because
with weak symbol resolution we now promote the prevailing copy to
weak_odr, and therefore we are guaranteed to have an externally
available copy somewhere.

This change is theoretically necessary due to r294014 which changed
the importer to use the IRMover directly instead of the ModuleLinker.
The ModuleLinker had some magic to link in the rest of the comdat
including any values marked for link. This had other issues as we don't
generally want to import values not selected by the thin link, but it
would have protected against creating an incomplete comdat group. Since
with this change we will now always import as available_externally
(which are condidered declarations and dropped from any comdat), we
avoid this issue.

Note that other changes are required to the fact that we can no longer
import aliases that have a linkonce_odr aliasee, so some special casing
is removed and tests changed accordingly.


https://reviews.llvm.org/D29509

Files:
  lib/Transforms/IPO/FunctionImport.cpp
  lib/Transforms/Utils/FunctionImportUtils.cpp
  test/Linker/funcimport.ll
  test/ThinLTO/X86/alias_import.ll
  test/ThinLTO/X86/select_right_alias_definition.ll
  test/Transforms/FunctionImport/funcimport.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29509.87005.patch
Type: text/x-patch
Size: 16016 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170203/56125f80/attachment.bin>


More information about the llvm-commits mailing list