|
13 | 13 | ; 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
|
14 | 14 | ; RUN: llvm-lto -thinlto-action=promote %t2.bc -thinlto-index=%t3.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=MOD2
|
15 | 15 | ; 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 |
17 | 17 |
|
18 | 18 | ;; Now try this with the new LTO API
|
19 | 19 | ; RUN: llvm-lto2 run %t.bc %t2.bc -o %t3.out -save-temps \
|
20 | 20 | ; RUN: -r %t.bc,_linkonceodralias,pl \
|
21 | 21 | ; RUN: -r %t.bc,_linkoncealias,pl \
|
22 | 22 | ; RUN: -r %t.bc,_linkonceodrvarInSingleModule,pl \
|
23 | 23 | ; RUN: -r %t.bc,_weakodrvarInSingleModule,pl \
|
| 24 | +; RUN: -r %t.bc,_weakvarInSingleModule,pl \ |
24 | 25 | ; RUN: -r %t.bc,_linkonceodrfuncwithalias,pl \
|
25 | 26 | ; RUN: -r %t.bc,_linkoncefuncwithalias,pl \
|
26 | 27 | ; RUN: -r %t.bc,_linkonceodrfunc,pl \
|
27 | 28 | ; RUN: -r %t.bc,_linkoncefunc,pl \
|
28 | 29 | ; RUN: -r %t.bc,_weakodrfunc,pl \
|
29 | 30 | ; RUN: -r %t.bc,_weakfunc,pl \
|
30 | 31 | ; RUN: -r %t.bc,_linkonceodrfuncInSingleModule,pl \
|
| 32 | +; RUN: -r %t.bc,_weakfuncInSingleModule,pl \ |
31 | 33 | ; RUN: -r %t2.bc,_linkonceodrfuncwithalias,l \
|
32 | 34 | ; RUN: -r %t2.bc,_linkoncefuncwithalias,l \
|
33 | 35 | ; RUN: -r %t2.bc,_linkonceodrfunc,l \
|
@@ -55,8 +57,10 @@ target triple = "x86_64-apple-macosx10.11.0"
|
55 | 57 | ;; of whether they are const or *unnamed_addr.
|
56 | 58 | ; MOD1-INT: @linkonceodrvarInSingleModule = internal global
|
57 | 59 | ; MOD1-INT: @weakodrvarInSingleModule = internal global
|
| 60 | +; MOD1-INT: @weakvarInSingleModule = internal global |
58 | 61 | @linkonceodrvarInSingleModule = linkonce_odr dso_local global ptr null, align 8
|
59 | 62 | @weakodrvarInSingleModule = weak_odr dso_local global ptr null, align 8
|
| 63 | +@weakvarInSingleModule = weak dso_local global ptr null, align 8 |
60 | 64 |
|
61 | 65 | ;; Function with an alias are resolved to weak_odr in prevailing module, but
|
62 | 66 | ;; not optimized in non-prevailing module (illegal to have an
|
@@ -115,3 +119,11 @@ define linkonce_odr void @linkonceodrfuncInSingleModule() #0 {
|
115 | 119 | entry:
|
116 | 120 | ret void
|
117 | 121 | }
|
| 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