1target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 2target triple = "x86_64-grtev4-linux-gnu" 3 4%struct.A = type { i32 (...)** } 5%struct.B = type { %struct.A } 6%struct.C = type { %struct.A } 7%struct.D = type { i32 (...)** } 8%struct.E = type { i32 (...)** } 9 10@_ZTV1B = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.B*, i32)* @_ZN1B1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !1 11@_ZTV1C = constant { [4 x i8*] } { [4 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.C*, i32)* @_ZN1C1fEi to i8*), i8* bitcast (i32 (%struct.A*, i32)* @_ZN1A1nEi to i8*)] }, !type !0, !type !2 12@_ZTV1D = linkonce_odr constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.D*, i32)* @_ZN1D1mEi to i8*)] }, !type !3 13@_ZTV1E = constant { [3 x i8*] } { [3 x i8*] [i8* null, i8* undef, i8* bitcast (i32 (%struct.E*, i32)* @_ZN1E1mEi to i8*)] }, !type !4 14 15define i32 @_ZN1B1fEi(%struct.B* %this, i32 %a) #0 { 16 ret i32 0 17} 18 19define internal i32 @_ZN1A1nEi(%struct.A* %this, i32 %a) #0 { 20 ret i32 0 21} 22 23define i32 @_ZN1C1fEi(%struct.C* %this, i32 %a) #0 { 24 ret i32 0 25} 26 27define linkonce_odr i32 @_ZN1D1mEi(%struct.D* %this, i32 %a) #0 { 28 ret i32 0 29} 30 31define internal i32 @_ZN1E1mEi(%struct.E* %this, i32 %a) #0 { 32 ret i32 0, !dbg !12 33} 34 35define i32 @test2(%struct.E* %obj, i32 %a) { 36entry: 37 %0 = bitcast %struct.E* %obj to i8***, !dbg !12 38 %vtable2 = load i8**, i8*** %0 39 %1 = bitcast i8** %vtable2 to i8* 40 %p2 = call i1 @llvm.type.test(i8* %1, metadata !"_ZTS1E") 41 call void @llvm.assume(i1 %p2) 42 43 %2 = bitcast i8** %vtable2 to i32 (%struct.E*, i32)** 44 %fptr33 = load i32 (%struct.E*, i32)*, i32 (%struct.E*, i32)** %2, align 8 45 46 %call4 = tail call i32 %fptr33(%struct.E* nonnull %obj, i32 %a) 47 ret i32 %call4 48} 49 50attributes #0 = { noinline optnone } 51 52declare i1 @llvm.type.test(i8*, metadata) 53declare void @llvm.assume(i1) 54 55!llvm.dbg.cu = !{!5} 56!llvm.module.flags = !{!13, !14, !15} 57 58!0 = !{i64 16, !"_ZTS1A"} 59!1 = !{i64 16, !"_ZTS1B"} 60!2 = !{i64 16, !"_ZTS1C"} 61!3 = !{i64 16, !"_ZTS1D"} 62!4 = !{i64 16, !"_ZTS1E"} 63!5 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !6, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !7, splitDebugInlining: false, nameTableKind: None) 64!6 = !DIFile(filename: "test.cc", directory: "/tmp") 65!7 = !{} 66!8 = distinct !DISubprogram(name: "bar", linkageName: "_Z5barv", scope: !6, file: !6, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !7) 67!9 = !DISubroutineType(types: !10) 68!10 = !{!11} 69!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 70!12 = !DILocation(line: 2, column: 3, scope: !8, inlinedAt: !16) 71!13 = !{i32 7, !"Dwarf Version", i32 4} 72!14 = !{i32 2, !"Debug Info Version", i32 3} 73!15 = !{i32 1, !"wchar_size", i32 4} 74!16 = !DILocation(line: 1, column: 1, scope: !17) 75!17 = distinct !DISubprogram(name: "foo", linkageName: "_Z5foov", scope: !6, file: !6, line: 1, type: !9, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !5, retainedNodes: !7) 76