Skip to content

Commit b90d2d6

Browse files
committed
[ThinLTO][test] Test prevailing non-exported non-ODR linkonce/odr can be internalized
To improve the tests added by D151965. Discovered when writing D158949.
1 parent b9b81e3 commit b90d2d6

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

llvm/test/ThinLTO/X86/weak_resolution.ll

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@
1313
; 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
1414
; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=MOD2
1515
; When exported, we always preserve a linkonce
16-
; RUN: llvm-lto -thinlto-action=promote %t.bc -thinlto-index=%t3.bc -o - --exported-symbol=_linkonceodrfuncInSingleModule | llvm-dis -o - | FileCheck %s --check-prefix=EXPORTED
16+
; 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
1717

1818
;; Now try this with the new LTO API
1919
; RUN: llvm-lto2 run %t.bc %t2.bc -o %t3.out -save-temps \
2020
; RUN: -r %t.bc,_linkonceodralias,pl \
2121
; RUN: -r %t.bc,_linkoncealias,pl \
2222
; RUN: -r %t.bc,_linkonceodrvarInSingleModule,pl \
2323
; RUN: -r %t.bc,_weakodrvarInSingleModule,pl \
24+
; RUN: -r %t.bc,_weakvarInSingleModule,pl \
2425
; RUN: -r %t.bc,_linkonceodrfuncwithalias,pl \
2526
; RUN: -r %t.bc,_linkoncefuncwithalias,pl \
2627
; RUN: -r %t.bc,_linkonceodrfunc,pl \
2728
; RUN: -r %t.bc,_linkoncefunc,pl \
2829
; RUN: -r %t.bc,_weakodrfunc,pl \
2930
; RUN: -r %t.bc,_weakfunc,pl \
3031
; RUN: -r %t.bc,_linkonceodrfuncInSingleModule,pl \
32+
; RUN: -r %t.bc,_weakfuncInSingleModule,pl \
3133
; RUN: -r %t2.bc,_linkonceodrfuncwithalias,l \
3234
; RUN: -r %t2.bc,_linkoncefuncwithalias,l \
3335
; RUN: -r %t2.bc,_linkonceodrfunc,l \
@@ -55,8 +57,10 @@ target triple = "x86_64-apple-macosx10.11.0"
5557
;; of whether they are const or *unnamed_addr.
5658
; MOD1-INT: @linkonceodrvarInSingleModule = internal global
5759
; MOD1-INT: @weakodrvarInSingleModule = internal global
60+
; MOD1-INT: @weakvarInSingleModule = internal global
5861
@linkonceodrvarInSingleModule = linkonce_odr dso_local global ptr null, align 8
5962
@weakodrvarInSingleModule = weak_odr dso_local global ptr null, align 8
63+
@weakvarInSingleModule = weak dso_local global ptr null, align 8
6064

6165
;; Function with an alias are resolved to weak_odr in prevailing module, but
6266
;; not optimized in non-prevailing module (illegal to have an
@@ -115,3 +119,11 @@ define linkonce_odr void @linkonceodrfuncInSingleModule() #0 {
115119
entry:
116120
ret void
117121
}
122+
123+
; MOD1: define weak void @weakfuncInSingleModule()
124+
; MOD1-INT: define internal void @weakfuncInSingleModule()
125+
; EXPORTED: define weak void @weakfuncInSingleModule()
126+
define weak void @weakfuncInSingleModule() {
127+
entry:
128+
ret void
129+
}

0 commit comments

Comments
 (0)