1; RUN: opt -module-summary %s -o %t.o
2; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s
3; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS
4; RUN: llvm-lto -thinlto -o %t2 %t.o
5; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck --check-prefix=COMBINED %s
6; RUN: llvm-dis -o - %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS
7
8; COMBINED: <TYPE_TESTS op0=-2012135647395072713/>
9; COMBINED: <TYPE_TESTS op0=6699318081062747564 op1=-2012135647395072713/>
10; COMBINED: <TYPE_TESTS op0=6699318081062747564/>
11
12; CHECK: <TYPE_TESTS op0=6699318081062747564/>
13define i1 @f() {
14  %p = call i1 @llvm.type.test(i8* null, metadata !"foo")
15  ret i1 %p
16}
17
18; CHECK: <TYPE_TESTS op0=6699318081062747564 op1=-2012135647395072713/>
19define i1 @g() {
20  %p = call i1 @llvm.type.test(i8* null, metadata !"foo")
21  %q = call i1 @llvm.type.test(i8* null, metadata !"bar")
22  %pq = and i1 %p, %q
23  ret i1 %pq
24}
25
26; CHECK: <TYPE_TESTS op0=-2012135647395072713/>
27define i1 @h() {
28  %p = call i1 @llvm.type.test(i8* null, metadata !"bar")
29  ret i1 %p
30}
31
32declare i1 @llvm.type.test(i8*, metadata) nounwind readnone
33
34; DIS: ^0 = module: (path: "{{.*}}thinlto-type-tests.ll.tmp.o", hash: (0, 0, 0, 0, 0))
35; DIS: ^1 = gv: (name: "llvm.type.test") ; guid = 608142985856744218
36; DIS: ^2 = gv: (name: "h", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (16434608426314478903))))) ; guid = 8124147457056772133
37; DIS: ^3 = gv: (name: "g", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 4, typeIdInfo: (typeTests: (6699318081062747564, 16434608426314478903))))) ; guid = 13146401226427987378
38; DIS: ^4 = gv: (name: "f", summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (6699318081062747564))))) ; guid = 14740650423002898831
39
40; COMBINED-DIS: ^0 = module: (path: "{{.*}}thinlto-type-tests.ll.tmp.o", hash: (0, 0, 0, 0, 0))
41; COMBINED-DIS: ^1 = gv: (guid: 8124147457056772133, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (16434608426314478903)))))
42; COMBINED-DIS: ^2 = gv: (guid: 13146401226427987378, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 4, typeIdInfo: (typeTests: (6699318081062747564, 16434608426314478903)))))
43; COMBINED-DIS: ^3 = gv: (guid: 14740650423002898831, summaries: (function: (module: ^0, flags: (linkage: external, notEligibleToImport: 0, live: 0, dsoLocal: 0), insts: 2, typeIdInfo: (typeTests: (6699318081062747564)))))
44