131 lines · plain
1; RUN: opt -module-summary %s -o %t.o2; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s3; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS4; Round trip it through llvm-as5; RUN: llvm-dis -o - %t.o | llvm-as -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS6; RUN: llvm-lto -thinlto -o %t2 %t.o7; RUN: llvm-bcanalyzer -dump %t2.thinlto.bc | FileCheck --check-prefix=COMBINED %s8; RUN: llvm-dis -o - %t2.thinlto.bc | FileCheck %s --check-prefix=COMBINED-DIS9; Round trip it through llvm-as10; RUN: llvm-dis -o - %t2.thinlto.bc | llvm-as -o - | llvm-dis -o - | FileCheck %s --check-prefix=COMBINED-DIS11 12target datalayout = "e-p:64:64"13target triple = "x86_64-unknown-linux-gnu"14 15; COMBINED: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=16/>16; COMBINED-NEXT: <COMBINED17; COMBINED-NEXT: <TYPE_CHECKED_LOAD_VCALLS op0=6699318081062747564 op1=16/>18; COMBINED-NEXT: <COMBINED19; COMBINED-NEXT: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=24 op2=-2012135647395072713 op3=32/>20; COMBINED-NEXT: <COMBINED21; 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: <COMBINED24; COMBINED-NEXT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>25; COMBINED-NEXT: <COMBINED26; COMBINED-NEXT: <TYPE_TESTS op0=7546896869197086323/>27; COMBINED-NEXT: <COMBINED28 29; CHECK: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=16/>30define 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 235 %fptr = load i8*, i8** %fptrptr36 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*37 call void %fptr_casted(i8* null, i32 undef)38 ret void39}40 41; CHECK: <TYPE_TEST_ASSUME_VCALLS op0=6699318081062747564 op1=24 op2=-2012135647395072713 op3=32/>42define 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 347 %fptr = load i8*, i8** %fptrptr48 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*49 call void %fptr_casted(i8* null, i32 undef)50 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 455 %fptr2 = load i8*, i8** %fptrptr256 %fptr_casted2 = bitcast i8* %fptr2 to void (i8*, i128)*57 call void %fptr_casted2(i8* null, i128 0)58 59 ret void60}61 62; CHECK: <TYPE_CHECKED_LOAD_VCALLS op0=6699318081062747564 op1=16/>63define 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, 066 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*67 call void %fptr_casted(i8* null, i32 undef)68 ret void69}70 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/>73define 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 278 %fptr = load i8*, i8** %fptrptr79 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*80 call void %fptr_casted(i8* null, i32 42)81 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 386 %fptr2 = load i8*, i8** %fptrptr287 %fptr_casted2 = bitcast i8* %fptr2 to void (i8*, i32)*88 call void %fptr_casted2(i8* null, i32 43)89 ret void90}91 92; CHECK: <TYPE_CHECKED_LOAD_CONST_VCALL op0=6699318081062747564 op1=16 op2=42/>93define 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, 096 %fptr_casted = bitcast i8* %fptr to void (i8*, i32)*97 call void %fptr_casted(i8* null, i32 42)98 ret void99}100 101; CHECK-NOT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=7546896869197086323102; CHECK: <TYPE_TESTS op0=7546896869197086323/>103; CHECK-NOT: <TYPE_CHECKED_LOAD_CONST_VCALL op0=7546896869197086323104define {i8*, i1} @f6(i8* %vtable) {105 %pair = call {i8*, i1} @llvm.type.checked.load(i8* %vtable, i32 16, metadata !"baz")106 ret {i8*, i1} %pair107}108 109declare i1 @llvm.type.test(i8*, metadata) nounwind readnone110declare void @llvm.assume(i1)111declare {i8*, i1} @llvm.type.checked.load(i8*, i32, metadata)112 113; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0))114; DIS: ^1 = gv: (name: "llvm.type.test") ; guid = 608142985856744218115; 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 = 2072045998141807037116; 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 = 4197650231481825559117; DIS: ^4 = gv: (name: "llvm.type.checked.load") ; guid = 5568222536364573403118; DIS: ^5 = gv: (name: "llvm.assume") ; guid = 6385187066495850096119; 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 = 8471399308421654326120; 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 = 10064745020953272174121; 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 = 11686717102184386164122; 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 = 11834966808443348068123 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)))))131