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
12 target datalayout = "e-p:64:64"
13 target triple = "x86_64-unknown-linux-gnu"
15 ; COMBINED: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=16/>
16 ; COMBINED-NEXT: <COMBINED
17 ; COMBINED-NEXT: <TYPE_CHECKED_LOAD_VCALLS op0=6699318081062747564 op1=16/>
18 ; COMBINED-NEXT: <COMBINED
19 ; COMBINED-NEXT: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=24 op2=-2012135647395072713 op3=32/>
20 ; COMBINED-NEXT: <COMBINED
21 ; COMBINED-NEXT: <TYPE_TEST_ASSUME_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>
22 ; COMBINED-NEXT: <TYPE_TEST_ASSUME_CONST_VCALL op0=6699318081062747564 op1=24 op2=43/>
23 ; COMBINED-NEXT: <COMBINED
24 ; COMBINED-NEXT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>
25 ; COMBINED-NEXT: <COMBINED
26 ; COMBINED-NEXT: <TYPE_TESTS op0=7546896869197086323/>
27 ; COMBINED-NEXT: <COMBINED
29 ; CHECK: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=16/>
30 define void @f1([3 x i8*]* %vtable) {
31 %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
32 %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"foo")
33 call void @llvm.assume(i1 %p)
34 %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 2
35 %fptr = load i8*, i8** %fptrptr
36 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*
37 call void %fptr_casted(i8* null, i32 undef)
41 ; CHECK: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=24 op2=-2012135647395072713 op3=32/>
42 define void @f2([3 x i8*]* %vtable, [3 x i8*]* %vtable2) {
43 %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
44 %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"foo")
45 call void @llvm.assume(i1 %p)
46 %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 3
47 %fptr = load i8*, i8** %fptrptr
48 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*
49 call void %fptr_casted(i8* null, i32 undef)
51 %vtablei82 = bitcast [3 x i8*]* %vtable2 to i8*
52 %p2 = call i1 @llvm.type.test(i8* %vtablei82, metadata !"bar")
53 call void @llvm.assume(i1 %p2)
54 %fptrptr2 = getelementptr [3 x i8*], [3 x i8*]* %vtable2, i32 0, i32 4
55 %fptr2 = load i8*, i8** %fptrptr2
56 %fptr_casted2 = bitcast i8* %fptr2 to void (i8*, i128)*
57 call void %fptr_casted2(i8* null, i128 0)
62 ; CHECK: <TYPE_CHECKED_LOAD_VCALLS op0=6699318081062747564 op1=16/>
63 define void @f3(i8* %vtable) {
64 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtable, i32 16, metadata !"foo")
65 %fptr = extractvalue {i8*, i1} %pair, 0
66 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*
67 call void %fptr_casted(i8* null, i32 undef)
71 ; CHECK: <TYPE_TEST_ASSUME_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>
72 ; CHECK-NEXT: <TYPE_TEST_ASSUME_CONST_VCALL op0=6699318081062747564 op1=24 op2=43/>
73 define void @f4([3 x i8*]* %vtable, [3 x i8*]* %vtable2) {
74 %vtablei8 = bitcast [3 x i8*]* %vtable to i8*
75 %p = call i1 @llvm.type.test(i8* %vtablei8, metadata !"foo")
76 call void @llvm.assume(i1 %p)
77 %fptrptr = getelementptr [3 x i8*], [3 x i8*]* %vtable, i32 0, i32 2
78 %fptr = load i8*, i8** %fptrptr
79 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*
80 call void %fptr_casted(i8* null, i32 42)
82 %vtablei82 = bitcast [3 x i8*]* %vtable2 to i8*
83 %p2 = call i1 @llvm.type.test(i8* %vtablei82, metadata !"foo")
84 call void @llvm.assume(i1 %p2)
85 %fptrptr2 = getelementptr [3 x i8*], [3 x i8*]* %vtable2, i32 0, i32 3
86 %fptr2 = load i8*, i8** %fptrptr2
87 %fptr_casted2 = bitcast i8* %fptr2 to void (i8*, i32)*
88 call void %fptr_casted2(i8* null, i32 43)
92 ; CHECK: <TYPE_CHECKED_LOAD_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>
93 define void @f5(i8* %vtable) {
94 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtable, i32 16, metadata !"foo")
95 %fptr = extractvalue {i8*, i1} %pair, 0
96 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*
97 call void %fptr_casted(i8* null, i32 42)
101 ; CHECK-NOT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=7546896869197086323
102 ; CHECK: <TYPE_TESTS op0=7546896869197086323/>
103 ; CHECK-NOT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=7546896869197086323
104 define {i8*, i1} @f6(i8* %vtable) {
105 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtable, i32 16, metadata !"baz")
109 declare i1 @llvm.type.test(i8*, metadata) nounwind readnone
110 declare void @llvm.assume(i1)
111 declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)
113 ; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))
114 ; DIS: ^1 = gv: (name: "llvm.type.test") ; guid = 608142985856744218
115 ; DIS: ^2 = gv: (name: "f1", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 8, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16)))))) ; guid = 2072045998141807037
116 ; DIS: ^3 = gv: (name: "f3", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeCheckedLoadVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16)))))) ; guid = 4197650231481825559
117 ; DIS: ^4 = gv: (name: "llvm.type.checked.load") ; guid = 5568222536364573403
118 ; DIS: ^5 = gv: (name: "llvm.assume") ; guid = 6385187066495850096
119 ; DIS: ^6 = gv: (name: "f2", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 15, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 24), vFuncId: (guid: 16434608426314478903, offset: 32)))))) ; guid = 8471399308421654326
120 ; DIS: ^7 = gv: (name: "f4", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 15, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeConstVCalls: ((vFuncId: (guid: 6699318081062747564, offset: 16), args: (42)), (vFuncId: (guid: 6699318081062747564, offset: 24), args: (43))))))) ; guid = 10064745020953272174
121 ; DIS: ^8 = gv: (name: "f5", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeCheckedLoadConstVCalls: ((vFuncId: (guid: 6699318081062747564, offset: 16), args: (42))))))) ; guid = 11686717102184386164
122 ; DIS: ^9 = gv: (name: "f6", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 2, typeIdInfo: (typeTests: (7546896869197086323))))) ; guid = 11834966808443348068
124 ; COMBINED-DIS: ^0 = module: (path: "{{.*}}thinlto-type-vcalls.ll.tmp.o", hash: (0, 0, 0, 0, 0))
125 ; COMBINED-DIS: ^1 = gv: (guid: 2072045998141807037, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 8, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16))))))
126 ; COMBINED-DIS: ^2 = gv: (guid: 4197650231481825559, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeCheckedLoadVCalls: (vFuncId: (guid: 6699318081062747564, offset: 16))))))
127 ; COMBINED-DIS: ^3 = gv: (guid: 8471399308421654326, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 15, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeVCalls: (vFuncId: (guid: 6699318081062747564, offset: 24), vFuncId: (guid: 16434608426314478903, offset: 32))))))
128 ; COMBINED-DIS: ^4 = gv: (guid: 10064745020953272174, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 15, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeTestAssumeConstVCalls: ((vFuncId: (guid: 6699318081062747564, offset: 16), args: (42)), (vFuncId: (guid: 6699318081062747564, offset: 24), args: (43)))))))
129 ; COMBINED-DIS: ^5 = gv: (guid: 11686717102184386164, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 5, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), typeIdInfo: (typeCheckedLoadConstVCalls: ((vFuncId: (guid: 6699318081062747564, offset: 16), args: (42)))))))
130 ; COMBINED-DIS: ^6 = gv: (guid: 11834966808443348068, summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0, importType: definition), insts: 2, typeIdInfo: (typeTests: (7546896869197086323)))))