llvm-project/llvm/test/ThinLTO/X86
Teresa Johnson ea314fd476 [ThinLTO] Fix handling of weak interposable symbols
Summary:
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.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, dang, llvm-commits

Tags: #llvm

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

llvm-svn: 369766
2019-08-23 15:18:58 +00:00
..
Inputs [ThinLTO] Fix handling of weak interposable symbols 2019-08-23 15:18:58 +00:00
alias_import.ll [ThinLTO] Use original alias visibility when importing 2019-05-29 16:50:46 +00:00
alias_internal.ll [LTO] Fix a crash caused by accessing an empty ValueInfo 2018-11-02 23:49:21 +00:00
alias_resolution.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
autoupgrade.ll
builtin-nostrip.ll Commit accidentally omitted test case. 2019-04-01 16:29:40 +00:00
cache-config.ll
cache-icall.ll [llvm-nm][llvm-readelf] Avoid single-dash -long-option in tests 2019-04-27 16:12:14 +00:00
cache-import-lists.ll
cache-typeid-resolutions.ll [ThinLTO] Look through aliases when computing hash keys 2018-12-04 00:02:33 +00:00
cache.ll [test] Skip ThinLTO cache tests requiring atime setting on NetBSD 2018-12-05 11:15:50 +00:00
callees-metadata.ll
cfi-devirt.ll [CodeGen] Make branch funnels pass the machine verifier 2019-07-03 17:16:45 +00:00
cfi-distributed.ll [LTO] Record whether LTOUnit splitting is enabled in index 2019-01-11 18:31:57 +00:00
cfi-icall-only-defuse.ll [ThinLTO] only emit used or referenced CFI records to index 2019-07-09 18:50:55 +00:00
cfi-icall.ll [LTO] Record whether LTOUnit splitting is enabled in index 2019-01-11 18:31:57 +00:00
cfi.ll [LTO] Record whether LTOUnit splitting is enabled in index 2019-01-11 18:31:57 +00:00
crash_debuginfo.ll
deadstrip.ll Fix 2-field llvm.global_ctors `REQUIRES: asserts` tests after rL360742 2019-05-15 03:08:21 +00:00
debuginfo-compositetype-import.ll
debuginfo-cu-import.ll
devirt-after-icp.ll [CodeGen] Make branch funnels pass the machine verifier 2019-07-03 17:16:45 +00:00
devirt.ll [ThinLTO] Implement index-based WPD 2019-08-02 13:10:52 +00:00
devirt2.ll Use llvm-nm instead of nm in new test to unbreak Windows bot 2019-08-02 15:49:39 +00:00
diagnostic-handler-remarks-with-hotness.ll
diagnostic-handler-remarks.ll [Remarks] Extend -fsave-optimization-record to specify the format 2019-06-17 16:06:00 +00:00
dicompositetype-unique-alias.ll
dicompositetype-unique.ll
dicompositetype-unique2.ll
distributed_import.ll
distributed_indexes.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
dot-dumper-full-lto.ll [ThinLTO] Fix dot dumper for regular LTO modules 2018-10-24 07:48:32 +00:00
dot-dumper.ll [ThinLTO] Restructure AliasSummary to contain ValueInfo of Aliasee 2019-03-15 15:11:38 +00:00
dot-dumper2.ll [ThinLTO] Attempt to recommit r365188 after alignment fix 2019-07-05 15:25:05 +00:00
drop-debug-info.ll
dsolocal_dllimport.ll
emit_imports.ll
empty-module.ll
empty_module_with_cache.ll
export.ll
funcimport-debug.ll
funcimport-tbaa.ll
funcimport.ll [LTO] Drop non-prevailing definitions only if linkage is not local or appending 2018-11-08 20:10:07 +00:00
funcimport2.ll
function_entry_count.ll [ThinLTO] Fix test added in rL349076 2018-12-14 08:21:08 +00:00
globals-import-blockaddr.ll
globals-import-const-fold.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
globals-import.ll
import_opaque_type.ll
index-const-prop-O0.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-alias.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-cache.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-comdat.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-dead.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-full-lto.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-gvref.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-ldst.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop-linkage.ll [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
index-const-prop.ll ThinLTO: Do not import debug info for imported global constants 2018-12-05 21:42:17 +00:00
index-const-prop2.ll [ThinLTO] Attempt to recommit r365188 after alignment fix 2019-07-05 15:25:05 +00:00
internalize.ll [ThinLTO] Fix handling of weak interposable symbols 2019-08-23 15:18:58 +00:00
lazyload_metadata.ll [BPF] add new intrinsics preserve_{array,union,struct}_access_index 2019-07-09 01:51:36 +00:00
linkonce_aliasee_ref_import.ll
linkonce_odr_unnamed_addr.ll [ThinLTO] Auto-hide prevailing linkonce_odr only when all copies eligible 2019-05-10 20:08:24 +00:00
linkonce_resolution_comdat.ll IR: print value numbers for unnamed function arguments 2019-08-03 14:28:34 +00:00
lit.local.cfg [lit] Delete empty lines at the end of lit.local.cfg NFC 2019-06-17 09:51:07 +00:00
llvm.used.ll
load-store-caching.ll [ThinLTO] Attempt to recommit r365188 after alignment fix 2019-07-05 15:25:05 +00:00
local_name_conflict.ll [ThinLTO] Import local variables from the same module as caller 2018-11-29 17:02:42 +00:00
local_name_conflict_var.ll [ThinLTO] Import local variables from the same module as caller 2018-11-29 17:02:42 +00:00
merge-triple.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
module_asm2.ll
module_asm_glob.ll
module_summary_graph_traits.ll
newpm-basic.ll
nodevirt-nonpromoted-typeid.ll [ThinLTO] Implement index-based WPD 2019-08-02 13:10:52 +00:00
noinline.ll
personality-local.ll [llvm-readobj] Change -t to --symbols in tests. NFC 2019-05-01 09:28:24 +00:00
personality.ll [llvm-readobj] Change -t to --symbols in tests. NFC 2019-05-01 09:28:24 +00:00
pr35472.ll [ThinLTO] Fix a crash in lazy loading of Metadata 2018-11-14 20:58:04 +00:00
prefix_replace.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
printer.ll [NewPM][PassInstrumentation] Fix test added in r369024. 2019-08-15 23:24:14 +00:00
reference_non_importable.ll
referenced_by_constant.ll
save_objects.ll [ThinLTO] Adding architecture name into saved object filename 2019-04-29 21:39:54 +00:00
section.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
strong_non_prevailing.ll [llvm-nm] Fix handling of symbol types 't' 'd' 'r' 2019-05-09 12:43:37 +00:00
thinlto-internalize-used.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
tli-nobuiltin.ll
weak_externals.ll [ThinLTO] Don't internalize weak writeable variables 2019-05-13 11:53:05 +00:00
weak_resolution.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
weak_resolution_single.ll [ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols 2019-04-17 17:38:09 +00:00
writeonly.ll [ThinLTO] Attempt to recommit r365188 after alignment fix 2019-07-05 15:25:05 +00:00
writeonly2.ll [ThinLTO] Attempt to recommit r365188 after alignment fix 2019-07-05 15:25:05 +00:00