1 ; RUN: opt -module-summary %s -o %t1.bc
2 ; RUN: opt -module-summary %p/Inputs/internalize.ll -o %t2.bc
3 ; Link in %t2.bc first to force its copy of @weak_func_nonprevailing as
4 ; prevailing the %t1.bc copy as non-prevailing.
5 ; RUN: llvm-lto -thinlto-action=thinlink -o %t.index.bc %t2.bc %t1.bc
6 ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - | llvm-dis -o - | FileCheck %s --check-prefix=REGULAR
7 ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc -o - --exported-symbol=_foo | llvm-dis -o - | FileCheck %s --check-prefix=INTERNALIZE
9 ; Test the enable-lto-internalization option by setting it to false.
10 ; This makes sure indices are not marked as internallinkage and therefore
11 ; internalization does not happen.
12 ; RUN: llvm-lto -thinlto-action=internalize -thinlto-index %t.index.bc %t1.bc \
13 ; RUN: -enable-lto-internalization=false --exported-symbol=_foo
14 ; RUN: llvm-dis < %t1.bc.thinlto.internalized.bc | FileCheck %s --check-prefix=INTERNALIZE-OPTION-DISABLE
16 ; RUN: llvm-lto2 run %t1.bc -o %t.o -save-temps \
17 ; RUN: -r=%t1.bc,_foo,pxl \
18 ; RUN: -r=%t1.bc,_bar,pl \
19 ; RUN: -r=%t1.bc,_linkonce_func,pl \
20 ; RUN: -r=%t1.bc,_weak_func_prevailing,pl \
21 ; RUN: -r=%t1.bc,_alias1,plx \
22 ; RUN: -r=%t1.bc,_weak_func_nonprevailing,l
23 ; RUN: llvm-dis < %t.o.1.2.internalize.bc | FileCheck %s --check-prefix=INTERNALIZE2
25 ; Test the enable-lto-internalization option by setting it to false.
26 ; This makes sure indices are not marked as internallinkage and therefore
27 ; internalization does not happen.
28 ; RUN: llvm-lto2 run %t1.bc -o %t.o -save-temps -enable-lto-internalization=false \
29 ; RUN: -r=%t1.bc,_foo,pxl \
30 ; RUN: -r=%t1.bc,_bar,pl \
31 ; RUN: -r=%t1.bc,_linkonce_func,pl \
32 ; RUN: -r=%t1.bc,_weak_func_prevailing,pl \
33 ; RUN: -r=%t1.bc,_alias1,plx \
34 ; RUN: -r=%t1.bc,_weak_func_nonprevailing,l
35 ; RUN: llvm-dis < %t.o.1.2.internalize.bc | FileCheck %s --check-prefix=INTERNALIZE2-OPTION-DISABLE
37 ; REGULAR: define void @foo
38 ; REGULAR: define void @bar
39 ; REGULAR: define linkonce void @linkonce_func()
40 ; INTERNALIZE: define void @foo
41 ; INTERNALIZE: define internal void @bar
42 ; INTERNALIZE: define internal void @linkonce_func()
43 ; INTERNALIZE: define internal void @weak_func_prevailing()
44 ; INTERNALIZE: define weak void @weak_func_nonprevailing()
45 ; INTERNALIZE-OPTION-DISABLE: define void @foo
46 ; INTERNALIZE-OPTION-DISABLE: define void @bar
47 ; INTERNALIZE-OPTION-DISABLE: define weak void @linkonce_func()
48 ; INTERNALIZE-OPTION-DISABLE: define weak void @weak_func_prevailing()
49 ; INTERNALIZE-OPTION-DISABLE: define weak void @weak_func_nonprevailing()
50 ; INTERNALIZE2: define dso_local void @foo
51 ; INTERNALIZE2: define internal void @bar
52 ; INTERNALIZE2: define internal void @linkonce_func()
53 ; INTERNALIZE2: define internal void @weak_func_prevailing()
54 ; INTERNALIZE2: define weak dso_local void @weak_func_nonprevailing()
55 ; INTERNALIZE2-OPTION-DISABLE: define dso_local void @foo
56 ; INTERNALIZE2-OPTION-DISABLE: define dso_local void @bar
57 ; INTERNALIZE2-OPTION-DISABLE: define weak dso_local void @linkonce_func()
58 ; INTERNALIZE2-OPTION-DISABLE: define weak dso_local void @weak_func_prevailing()
59 ; INTERNALIZE2-OPTION-DISABLE: define weak dso_local void @weak_func_nonprevailing()
61 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
62 target triple = "x86_64-apple-macosx10.11.0"
69 call void @linkonce_func()
70 call void @weak_func_prevailing()
71 call void @weak_func_nonprevailing()
74 define linkonce void @linkonce_func() {
77 define weak void @weak_func_prevailing() {
80 ; Make @weak_func_nonprevailing an aliasee to ensure it is still marked
81 ; live and kept as a definition even when non-prevailing. We want to ensure
82 ; this definition is not internalized.
83 @alias1 = hidden alias void (), ptr @weak_func_nonprevailing
84 define weak void @weak_func_nonprevailing() {