[PATCH] D66264: [ThinLTO] Fix handling of weak interposable symbols
Teresa Johnson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 14 17:22:07 PDT 2019
tejohnson created this revision.
tejohnson added a reviewer: pcc.
Herald added subscribers: dang, dexonsmith, steven_wu, inglorion, mehdi_amini.
Herald added a project: LLVM.
Keep aliasees alive if their alias is live, otherwise we end up with an
alias to a declaration, which is invalid. This can happen when the
aliasee is weak and non-prevailing.
This fix exposed the fact that we were then attempting to internalize
the weak symbol, which was not exported as it was not prevailing. We
should not internalize interposable symbols in general, unless this is
the prevailing copy, since it can lead to incorrect inlining and other
optimizations. Most of the changes in this patch are due to the
restructuring required to pass down the prevailing callback.
Finally, while implementing the test cases, I found that in the case of
a weak aliasee that is still marked not live because its alias isn't
live, after dropping the definition we incorrectly marked the
declaration with weak linkage when resolving prevailing symbols in the
module. This was due to some special case handling for symbols marked
WeakLinkage in the summary located before instead of after a subsequent
check for the symbol being a declaration. It turns out that we don't
actually need this special case handling any more (looking back at the
history, when that was added the code was structured quite differently)
- we will correctly mark with weak linkage further below when the
definition hasn't been dropped.
Fixes PR42542.
Repository:
rL LLVM
https://reviews.llvm.org/D66264
Files:
include/llvm/LTO/LTO.h
lib/LTO/LTO.cpp
lib/LTO/ThinLTOCodeGenerator.cpp
lib/Transforms/IPO/FunctionImport.cpp
test/LTO/Resolution/X86/not-prevailing-weak-aliasee.ll
test/ThinLTO/X86/Inputs/internalize.ll
test/ThinLTO/X86/internalize.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66264.215291.patch
Type: text/x-patch
Size: 16800 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190815/a9e4feab/attachment-0001.bin>
More information about the llvm-commits
mailing list