1 ; Verifies that only functions defined or used by each module make it into the
2 ; CFI functions sets in that module's distributed index.
3 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %s -o %t1.bc
4 ; RUN: opt -thinlto-bc -thinlto-split-lto-unit %S/Inputs/cfi-icall-only-bazqux.ll -o %t2.bc
5 ; RUN: llvm-lto2 run -thinlto-distributed-indexes %t1.bc %t2.bc -o %t.out \
6 ; RUN: -r %t1.bc,bar,plx \
7 ; RUN: -r %t1.bc,baz,x \
8 ; RUN: -r %t1.bc,f,plx \
9 ; RUN: -r %t1.bc,foo,plx \
10 ; RUN: -r %t2.bc,bar,x \
11 ; RUN: -r %t2.bc,baz,plx \
12 ; RUN: -r %t2.bc,g,plx \
13 ; RUN: -r %t2.bc,qux,plx
14 ; RUN: llvm-bcanalyzer -dump %t1.bc.thinlto.bc | FileCheck %s --check-prefix=FOOBAZ
15 ; RUN: llvm-bcanalyzer -dump %t2.bc.thinlto.bc | FileCheck %s --check-prefix=BARQUX
17 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
18 target triple = "x86_64-unknown-linux-gnu"
20 declare !type !0 i8 @baz(i8*)
21 declare i1 @llvm.type.test(i8* %ptr, metadata %type) nounwind readnone
23 define i8 @foo(i8* %p) !type !0 {
24 %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
25 %1 = select i1 %x, i8 0, i8 1
29 define i8 @bar(i8* %p) !type !0 {
30 %x = call i1 @llvm.type.test(i8* %p, metadata !"t1")
34 define i8 @f(i1 %i, i8* %p) {
35 %1 = select i1 %i, i8(i8*)* @foo, i8(i8*)* @baz
36 %2 = call i8 %1(i8* %p)
42 ; FOOBAZ: <GLOBALVAL_SUMMARY_BLOCK
43 ; FOOBAZ: <CFI_FUNCTION_DEFS op0=0 op1=3 op2=3 op3=3 op4=6 op5=3/>
44 ; FOOBAZ: <TYPE_ID op0=9 op1=2 op2=4 op3=7 op4=0 op5=0 op6=0 op7=0/>
45 ; FOOBAZ: </GLOBALVAL_SUMMARY_BLOCK>
46 ; FOOBAZ: <STRTAB_BLOCK
47 ; FOOBAZ-NEXT: <BLOB abbrevid=4/> blob data = 'barbazfoot1'
48 ; FOOBAZ-NEXT: </STRTAB_BLOCK>
50 ; BARQUX: <GLOBALVAL_SUMMARY_BLOCK
51 ; BARQUX: <CFI_FUNCTION_DEFS op0=0 op1=3 op2=3 op3=3 op4=6 op5=3/>
52 ; BARQUX: <TYPE_ID op0=9 op1=2 op2=4 op3=7 op4=0 op5=0 op6=0 op7=0/>
53 ; BARQUX: </GLOBALVAL_SUMMARY_BLOCK>
54 ; BARQUX: <STRTAB_BLOCK
55 ; BARQUX-NEXT: <BLOB abbrevid=4/> blob data = 'barbazquxt1'
56 ; BARQUX-NEXT: </STRTAB_BLOCK>