OSDN Git Service

[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols
authorSteven Wu <stevenwu@apple.com>
Wed, 17 Apr 2019 17:38:09 +0000 (17:38 +0000)
committerSteven Wu <stevenwu@apple.com>
Wed, 17 Apr 2019 17:38:09 +0000 (17:38 +0000)
commitf8c4f81342cbd7b046b4fd9b8df7f60cfbb2a789
tree3b9a33d8de14e5a96a7aeada5b129432f49350f5
parent36a87ca3648ab0025bd2c6e0b091926315f43874
[ThinLTO] Fix ThinLTOCodegenerator to export llvm.used symbols

Summary:
Reapply r357931 with fixes to ThinLTO testcases and llvm-lto tool.

ThinLTOCodeGenerator currently does not preserve llvm.used symbols and
it can internalize them. In order to pass the necessary information to the
legacy ThinLTOCodeGenerator, the input to the code generator is
rewritten to be based on lto::InputFile.

Now ThinLTO using the legacy LTO API will requires data layout in
Module.

"internalize" thinlto action in llvm-lto is updated to run both
"promote" and "internalize" with the same configuration as
ThinLTOCodeGenerator. The old "promote" + "internalize" option does not
produce the same output as ThinLTOCodeGenerator.

This fixes: PR41236
rdar://problem/49293439

Reviewers: tejohnson, pcc, kromanova, dexonsmith

Reviewed By: tejohnson

Subscribers: ormris, bd1976llvm, mehdi_amini, inglorion, eraman, hiraditya, jkorous, dexonsmith, arphaman, dang, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358601 91177308-0d34-0410-b5e6-96231b3b80d8
26 files changed:
include/llvm/LTO/LTO.h
include/llvm/LTO/legacy/ThinLTOCodeGenerator.h
lib/LTO/LTO.cpp
lib/LTO/ThinLTOCodeGenerator.cpp
test/Bitcode/Inputs/module_hash.ll
test/Bitcode/module_hash.ll
test/ThinLTO/X86/Inputs/alias_import.ll
test/ThinLTO/X86/Inputs/alias_resolution.ll
test/ThinLTO/X86/Inputs/distributed_indexes.ll
test/ThinLTO/X86/Inputs/merge-triple.ll
test/ThinLTO/X86/Inputs/section.ll
test/ThinLTO/X86/Inputs/thinlto-internalize-used2.ll [new file with mode: 0644]
test/ThinLTO/X86/alias_import.ll
test/ThinLTO/X86/alias_resolution.ll
test/ThinLTO/X86/deadstrip.ll
test/ThinLTO/X86/distributed_indexes.ll
test/ThinLTO/X86/internalize.ll
test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll
test/ThinLTO/X86/merge-triple.ll
test/ThinLTO/X86/prefix_replace.ll
test/ThinLTO/X86/section.ll
test/ThinLTO/X86/thinlto-internalize-used.ll [new file with mode: 0644]
test/ThinLTO/X86/weak_resolution.ll
test/ThinLTO/X86/weak_resolution_single.ll
test/Transforms/ThinLTOBitcodeWriter/no-type-md.ll
tools/llvm-lto/llvm-lto.cpp