File: public-type-test.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (72 lines) | stat: -rw-r--r-- 2,513 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
; Test to ensure that the LTO API (legacy and new) lowers @llvm.public.type.test.

; RUN: split-file %s %t

; RUN: opt -module-summary %t/main.ll -o %t/main.bc
; RUN: opt -module-summary %t/foo.ll -o %t/foo.bc
; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t/main.bc %t/foo.bc --thinlto-save-temps=%t2.
; RUN: llvm-dis -o - %t2.0.3.imported.bc | FileCheck %s --check-prefix=PUBLIC
; RUN: llvm-lto --thinlto-action=run -exported-symbol=_main %t/main.bc %t/foo.bc --thinlto-save-temps=%t2. --whole-program-visibility
; RUN: llvm-dis -o - %t2.0.3.imported.bc | FileCheck %s --check-prefix=HIDDEN

; RUN: llvm-lto2 run %t/main.bc %t/foo.bc -save-temps -pass-remarks=. \
; RUN:   -whole-program-visibility \
; RUN:   -o %t3 \
; RUN:   -r=%t/main.bc,_main,px \
; RUN:   -r=%t/main.bc,_bar,px \
; RUN:   -r=%t/main.bc,_foo, \
; RUN:   -r=%t/foo.bc,_foo,px
; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=HIDDEN
; RUN: llvm-lto2 run %t/main.bc %t/foo.bc -save-temps -pass-remarks=. \
; RUN:   -o %t3 \
; RUN:   -r=%t/main.bc,_main,px \
; RUN:   -r=%t/main.bc,_bar,px \
; RUN:   -r=%t/main.bc,_foo, \
; RUN:   -r=%t/foo.bc,_foo,px
; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=PUBLIC

; PUBLIC-NOT: call {{.*}}@llvm.public.type.test
; PUBLIC-NOT: call {{.*}}@llvm.type.test
;; We should have converted the type tests from both main and the imported
;; copy of foo to non-public.
; HIDDEN-NOT: call {{.*}}@llvm.public.type.test
; HIDDEN: call {{.*}}@llvm.type.test
; HIDDEN-NOT: call {{.*}}@llvm.public.type.test
; HIDDEN: call {{.*}}@llvm.type.test

;--- main.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9"

define i32 @main(ptr %vtable) {
entry:
  %p = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS1A")
  call void @llvm.assume(i1 %p)
  call void @bar(ptr %vtable)
  ret i32 0
}

define void @bar(ptr %vtable) {
entry:
  call void @foo(ptr %vtable)
  ret void
}

declare void @foo(ptr %vtable)

declare void @llvm.assume(i1)
declare i1 @llvm.public.type.test(ptr, metadata)

;--- foo.ll
target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9"

define void @foo(ptr %vtable) {
entry:
  %p = call i1 @llvm.public.type.test(ptr %vtable, metadata !"_ZTS1A")
  call void @llvm.assume(i1 %p)
  ret void
}

declare void @llvm.assume(i1)
declare i1 @llvm.public.type.test(ptr, metadata)