diff options
| author | Steven Wu <stevenwu@apple.com> | 2018-02-09 18:34:08 +0000 |
|---|---|---|
| committer | Steven Wu <stevenwu@apple.com> | 2018-02-09 18:34:08 +0000 |
| commit | 33ba93c2b5e6fd8a4d9663a9b50ace9e104ef50d (patch) | |
| tree | f305cc9e9bb0e0c0737a5ce2d1af59a4ad88a948 /llvm/test | |
| parent | 37a9889309ae533bc5aa9609e108eb8d306f445b (diff) | |
| download | bcm5719-llvm-33ba93c2b5e6fd8a4d9663a9b50ace9e104ef50d.tar.gz bcm5719-llvm-33ba93c2b5e6fd8a4d9663a9b50ace9e104ef50d.zip | |
[ThinLTO] Teach ThinLTO about auto hide symbols
Summary:
For symbols that has linkonce_odr linkage and unnamed_addr, it can be
auto hide by linker to avoid weak external symbols. Teach ThinLTO to
perform auto hide so it can safely promote linkonce_odr to weak symbols
without breaking this nice property.
Reviewers: tejohnson, mehdi_amini
Reviewed By: tejohnson
Subscribers: inglorion, eraman, rnk, pcc, llvm-commits
Differential Revision: https://reviews.llvm.org/D43130
llvm-svn: 324757
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll | 10 | ||||
| -rw-r--r-- | llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll | 2 |
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll b/llvm/test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll new file mode 100644 index 00000000000..84bea3cbb9d --- /dev/null +++ b/llvm/test/ThinLTO/X86/linkonce_odr_unnamed_addr.ll @@ -0,0 +1,10 @@ +; This test ensures that when linkonce_odr + unnamed_addr symbols promoted to +; weak symbols, it preserves the auto hide property. + +; RUN: opt -module-summary %s -o %t.bc +; RUN: opt -module-summary %s -o %t2.bc +; RUN: llvm-lto -thinlto-action=thinlink -o %t3.bc %t.bc %t2.bc +; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s + +; CHECK: @linkonceodrunnamed = weak_odr hidden unnamed_addr constant i32 0 +@linkonceodrunnamed = linkonce_odr unnamed_addr constant i32 0 diff --git a/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll b/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll index c1ffdf176e5..b72cd2f29fe 100644 --- a/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll +++ b/llvm/test/ThinLTO/X86/linkonce_resolution_comdat.ll @@ -10,7 +10,7 @@ ; Copy from first module is prevailing and converted to weak_odr, copy ; from second module is preempted and converted to available_externally and ; removed from comdat. -; IMPORT1: define weak_odr i32 @f(i8*) unnamed_addr comdat($c1) { +; IMPORT1: define weak_odr hidden i32 @f(i8*) unnamed_addr comdat($c1) { ; IMPORT2: define available_externally i32 @f(i8*) unnamed_addr { ; RUN: llvm-nm -o - < %t1.bc.thinlto.o | FileCheck %s --check-prefix=NM1 |

