aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/ThinLTO
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2023-08-28 09:56:00 -0700
committerFangrui Song <i@maskray.me>2023-08-28 09:56:00 -0700
commitb90d2d6680b623ebeb4a3afa38003a6e261ee642 (patch)
treea302079b4d9d5a277124cad17d737c303800f675 /llvm/test/ThinLTO
parentb9b81e37fe63d661afa356eacc97208ccc85da29 (diff)
downloadllvm-b90d2d6680b623ebeb4a3afa38003a6e261ee642.zip
llvm-b90d2d6680b623ebeb4a3afa38003a6e261ee642.tar.gz
llvm-b90d2d6680b623ebeb4a3afa38003a6e261ee642.tar.bz2
[ThinLTO][test] Test prevailing non-exported non-ODR linkonce/odr can be internalized
To improve the tests added by D151965. Discovered when writing D158949.
Diffstat (limited to 'llvm/test/ThinLTO')
-rw-r--r--llvm/test/ThinLTO/X86/weak_resolution.ll14
1 files changed, 13 insertions, 1 deletions
diff --git a/llvm/test/ThinLTO/X86/weak_resolution.ll b/llvm/test/ThinLTO/X86/weak_resolution.ll
index 1bca0c7..15db40a 100644
--- a/llvm/test/ThinLTO/X86/weak_resolution.ll
+++ b/llvm/test/ThinLTO/X86/weak_resolution.ll
@@ -13,7 +13,7 @@
; RUN: llvm-lto -thinlto-action=internalize %t.bc -thinlto-index=%t3.bc -exported-symbol=_linkoncefunc -o - | llvm-dis -o - | FileCheck %s --check-prefix=MOD1-INT
; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=MOD2
; When exported, we always preserve a linkonce
-; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t3.bc -o - --exported-symbol=_linkonceodrfuncInSingleModule | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTED
+; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t3.bc -o - --exported-symbol=_linkonceodrfuncInSingleModule --exported-symbol=_weakfuncInSingleModule | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTED
;; Now try this with the new LTO API
; RUN: llvm-lto2 run %t.bc %t2.bc -o %t3.out -save-temps \
@@ -21,6 +21,7 @@
; RUN: -r %t.bc,_linkoncealias,pl \
; RUN: -r %t.bc,_linkonceodrvarInSingleModule,pl \
; RUN: -r %t.bc,_weakodrvarInSingleModule,pl \
+; RUN: -r %t.bc,_weakvarInSingleModule,pl \
; RUN: -r %t.bc,_linkonceodrfuncwithalias,pl \
; RUN: -r %t.bc,_linkoncefuncwithalias,pl \
; RUN: -r %t.bc,_linkonceodrfunc,pl \
@@ -28,6 +29,7 @@
; RUN: -r %t.bc,_weakodrfunc,pl \
; RUN: -r %t.bc,_weakfunc,pl \
; RUN: -r %t.bc,_linkonceodrfuncInSingleModule,pl \
+; RUN: -r %t.bc,_weakfuncInSingleModule,pl \
; RUN: -r %t2.bc,_linkonceodrfuncwithalias,l \
; RUN: -r %t2.bc,_linkoncefuncwithalias,l \
; RUN: -r %t2.bc,_linkonceodrfunc,l \
@@ -55,8 +57,10 @@ target triple = "x86_64-apple-macosx10.11.0"
;; of whether they are const or *unnamed_addr.
; MOD1-INT: @linkonceodrvarInSingleModule = internal global
; MOD1-INT: @weakodrvarInSingleModule = internal global
+; MOD1-INT: @weakvarInSingleModule = internal global
@linkonceodrvarInSingleModule = linkonce_odr dso_local global ptr null, align 8
@weakodrvarInSingleModule = weak_odr dso_local global ptr null, align 8
+@weakvarInSingleModule = weak dso_local global ptr null, align 8
;; Function with an alias are resolved to weak_odr in prevailing module, but
;; not optimized in non-prevailing module (illegal to have an
@@ -115,3 +119,11 @@ define linkonce_odr void @linkonceodrfuncInSingleModule() #0 {
entry:
ret void
}
+
+; MOD1: define weak void @weakfuncInSingleModule()
+; MOD1-INT: define internal void @weakfuncInSingleModule()
+; EXPORTED: define weak void @weakfuncInSingleModule()
+define weak void @weakfuncInSingleModule() {
+entry:
+ ret void
+}