1 ; Test to ensure that the LTO API (legacy and new) lowers @llvm.public.type.test.
3 ; RUN: split-file %s %t
5 ; RUN: opt -module-summary %t/main.ll -o %t/main.bc
6 ; RUN: opt -module-summary %t/foo.ll -o %t/foo.bc
7 ; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t/main.bc %t/foo.bc --thinlto-save-temps=%t2.
8 ; RUN: llvm-dis -o - %t2.0.3.imported.bc | FileCheck %s --check-prefix=PUBLIC
9 ; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t/main.bc %t/foo.bc --thinlto-save-temps=%t2. --whole-program-visibility
10 ; RUN: llvm-dis -o - %t2.0.3.imported.bc | FileCheck %s --check-prefix=HIDDEN
12 ; RUN: llvm-lto2 run %t/main.bc %t/foo.bc -save-temps -pass-remarks=. \
13 ; RUN: -whole-program-visibility \
15 ; RUN: -r=%t/main.bc,_main,px \
16 ; RUN: -r=%t/main.bc,_bar,px \
17 ; RUN: -r=%t/main.bc,_foo, \
18 ; RUN: -r=%t/foo.bc,_foo,px
19 ; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=HIDDEN
20 ; RUN: llvm-lto2 run %t/main.bc %t/foo.bc -save-temps -pass-remarks=. \
22 ; RUN: -r=%t/main.bc,_main,px \
23 ; RUN: -r=%t/main.bc,_bar,px \
24 ; RUN: -r=%t/main.bc,_foo, \
25 ; RUN: -r=%t/foo.bc,_foo,px
26 ; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=PUBLIC
28 ; PUBLIC-NOT: call {{.*}}@llvm.public.type.test
29 ; PUBLIC-NOT: call {{.*}}@llvm.type.test
30 ;; We should have converted the type tests from both main and the imported
31 ;; copy of foo to non-public.
32 ; HIDDEN-NOT: call {{.*}}@llvm.public.type.test
33 ; HIDDEN: call {{.*}}@llvm.type.test
34 ; HIDDEN-NOT: call {{.*}}@llvm.public.type.test
35 ; HIDDEN: call {{.*}}@llvm.type.test
38 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
39 target triple = "x86_64-apple-macosx10.9"
41 define i32 @main(ptr %vtable) {
43 %p = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS1A")
44 call void @llvm.assume(i1 %p)
45 call void @bar(ptr %vtable)
49 define void @bar(ptr %vtable) {
51 call void @foo(ptr %vtable)
55 declare void @foo(ptr %vtable)
57 declare void @llvm.assume(i1)
58 declare i1 @llvm.public.type.test(ptr, metadata)
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.9"
64 define void @foo(ptr %vtable) {
66 %p = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS1A")
67 call void @llvm.assume(i1 %p)
71 declare void @llvm.assume(i1)
72 declare i1 @llvm.public.type.test(ptr, metadata)