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