OSDN Git Service

ThinLTO: Don't import aliases of any kind (even linkonce_odr)
authorDavid Blaikie <dblaikie@gmail.com>
Thu, 27 Jul 2017 15:09:06 +0000 (15:09 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Thu, 27 Jul 2017 15:09:06 +0000 (15:09 +0000)
commita92181629c3721f8eaea30edb2f9b781b7b4fef7
tree4d8302ad18532127286d4c675a1ab370f489309a
parent4dabbadd262dc2a43dbb6c07c1797ce26d51d009
ThinLTO: Don't import aliases of any kind (even linkonce_odr)

Summary:
Until a more advanced version of importing can be implemented for
aliases (one that imports an alias as an available_externally definition
of the aliasee), skip the narrow subset of cases that was possible but
came at a cost: aliases of linkonce_odr functions could be imported
because the linkonce_odr function could be safely duplicated from the
source module. This came/comes at the cost of not being able to 'home'
imported linkonce functions (they had to be emitted linkonce_odr in all
the destination modules (even if they weren't used by an alias) rather
than as available_externally - causing extra object size).

Tangentially, this also was the only reason ThinLTO would emit multiple
CUs in to the resulting DWARF - which happens to be a problem for
Fission (there's a fix for this in GDB but not released yet, etc).
(actually it's not the only reason - but I'm sending a patch to fix the
other reason shortly)

There's no reason to believe this particularly narrow alias importing
was especially/meaningfully important, only that it was /possible/ to
implement in this way. When a more general solution is done, it should
still satisfy the DWARF concerns above, since the import will still be
available_externally, and thus not create extra CUs.

Since now all aliases are treated the same, I removed/simplified some
test cases since they were testing corner cases where there are no
longer any corners.

Reviewers: tejohnson, mehdi_amini

Differential Revision: https://reviews.llvm.org/D35875

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@309278 91177308-0d34-0410-b5e6-96231b3b80d8
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 [deleted file]
test/Transforms/FunctionImport/funcimport.ll