57 lines · plain
1; Verifies that only functions defined or used by each module make it into the2; CFI functions sets in that module's distributed index.3; RUN: opt -thinlto-bc -thinlto-split-lto-unit %s -o %t1.bc4; RUN: opt -thinlto-bc -thinlto-split-lto-unit %S/Inputs/cfi-icall-only-bazqux.ll -o %t2.bc5; 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,plx14; RUN: llvm-bcanalyzer -dump %t1.bc.thinlto.bc | FileCheck %s --check-prefix=FOOBAZ15; RUN: llvm-bcanalyzer -dump %t2.bc.thinlto.bc | FileCheck %s --check-prefix=BARQUX16 17target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"18target triple = "x86_64-unknown-linux-gnu"19 20declare !type !0 i8 @baz(ptr)21declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone22 23define i8 @foo(ptr %p) !type !0 {24 %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")25 %1 = select i1 %x, i8 0, i8 126 ret i8 %127}28 29define i8 @bar(ptr %p) !type !0 {30 %x = call i1 @llvm.type.test(ptr %p, metadata !"t1")31 ret i8 232}33 34define i8 @f(i1 %i, ptr %p) {35 %1 = select i1 %i, ptr @foo, ptr @baz36 %2 = call i8 %1(ptr %p)37 ret i8 %238}39 40!0 = !{i64 0, !"t1"}41 42; FOOBAZ: <GLOBALVAL_SUMMARY_BLOCK43; 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_BLOCK47; FOOBAZ-NEXT: <BLOB abbrevid=4/> blob data = 'barbazfoot1'48; FOOBAZ-NEXT: </STRTAB_BLOCK>49 50; BARQUX: <GLOBALVAL_SUMMARY_BLOCK51; 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_BLOCK55; BARQUX-NEXT: <BLOB abbrevid=4/> blob data = 'barbazquxt1'56; BARQUX-NEXT: </STRTAB_BLOCK>57