xref: /llvm-project/llvm/test/ThinLTO/X86/cache-typeid-resolutions.ll (revision d5d3eb16b7ab72529c83dacb2889811491e48909)
1; RUN: opt -module-hash -module-summary %s -o %t.bc
2; RUN: opt -module-hash -module-summary %S/Inputs/cache-typeid-resolutions-import.ll -o %t-import.bc
3
4; RUN: llvm-as -o %t1.bc %S/Inputs/cache-typeid-resolutions1.ll
5; RUN: llvm-as -o %t2.bc %S/Inputs/cache-typeid-resolutions2.ll
6; RUN: llvm-as -o %t3.bc %S/Inputs/cache-typeid-resolutions3.ll
7
8; Two resolutions for typeid1: Unsat, Single
9; where both t and t-import are sensitive to typeid1's resolution
10; so 4 distinct objects in total.
11; RUN: rm -rf %t.cache
12; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f1_actual,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -whole-program-visibility
13; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t1.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f1_actual,plx -r=%t.bc,f2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -r=%t1.bc,vt1,plx -whole-program-visibility
14; RUN: ls %t.cache | count 4
15
16; Three resolutions for typeid2: Indir, SingleImpl, UniqueRetVal
17; where both t and t-import are sensitive to typeid2's resolution
18; so 6 distinct objects in total.
19; RUN: rm -rf %t.cache
20; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -whole-program-visibility
21; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t2.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t2.bc,vt2,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -whole-program-visibility
22; RUN: llvm-lto2 run -o %t.o %t.bc %t-import.bc %t3.bc -cache-dir %t.cache -r=%t.bc,f1,plx -r=%t.bc,f2,plx -r=%t.bc,f1_actual,plx -r=%t3.bc,vt2a,plx -r=%t3.bc,vt2b,plx -r=%t-import.bc,importf1,plx -r=%t-import.bc,f1,lx -r=%t-import.bc,importf2,plx -r=%t-import.bc,f2,lx -whole-program-visibility
23; RUN: ls %t.cache | count 6
24
25target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
26target triple = "x86_64-unknown-linux-gnu"
27
28@f1 = alias i1(ptr), ptr @f1_actual
29
30define i1 @f1_actual(ptr %p) {
31  %x = call i1 @llvm.type.test(ptr %p, metadata !"typeid1")
32  ret i1 %x
33}
34
35define i1 @f2(ptr %obj) {
36  %vtable = load ptr, ptr %obj
37  %p = call i1 @llvm.type.test(ptr %vtable, metadata !"typeid2")
38  call void @llvm.assume(i1 %p)
39  %fptr = load ptr, ptr %vtable
40  %result = call i1 %fptr(ptr %obj)
41  ret i1 %result
42}
43
44declare i1 @llvm.type.test(ptr, metadata)
45declare void @llvm.assume(i1)
46