|
| 1 | +; RUN: opt -module-summary %s -o %t.o |
| 2 | + |
| 3 | +; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s |
| 4 | + |
| 5 | +; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS |
| 6 | + |
| 7 | + |
| 8 | +; CHECK: <GLOBALVAL_SUMMARY_BLOCK |
| 9 | +; CHECK-NEXT: <VERSION op0=9/> |
| 10 | +; CHECK-NEXT: <FLAGS op0=0/> |
| 11 | +; The `VALUE_GUID` below represents the "_ZN4Base4funcEv" referenced by the |
| 12 | +; indirect call instruction. |
| 13 | +; CHECK-NEXT: <VALUE_GUID op0=17 op1=5459407273543877811/> |
| 14 | +; <PERMODULE_PROFILE> has the format [valueid, flags, instcount, funcflags, |
| 15 | +; numrefs, rorefcnt, worefcnt, |
| 16 | +; n x (valueid, hotness+tailcall)] |
| 17 | +; CHECK-NEXT: <PERMODULE_PROFILE abbrevid=4 op0=0 op1=0 op2=4 op3=256 op4=0 op5=0 op6=0 op7=17 op8=3/> |
| 18 | +; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK> |
| 19 | + |
| 20 | +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 21 | +target triple = "x86_64-unknown-linux-gnu" |
| 22 | + |
| 23 | +; Function has one BB and an entry count of 150, so the BB is hot according to |
| 24 | +; ProfileSummary and reflected so in the bitcode (see llvm-dis output). |
| 25 | +define i32 @_Z4testP4Base(ptr %0) !prof !15 { |
| 26 | + %2 = load ptr, ptr %0, !prof !16 |
| 27 | + %3 = load ptr, ptr %2 |
| 28 | + %4 = tail call i32 %3(ptr %0), !prof !17 |
| 29 | + ret i32 %4 |
| 30 | +} |
| 31 | + |
| 32 | +!llvm.module.flags = !{!1} |
| 33 | + |
| 34 | + |
| 35 | +!1 = !{i32 1, !"ProfileSummary", !2} |
| 36 | +!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} |
| 37 | +!3 = !{!"ProfileFormat", !"InstrProf"} |
| 38 | +!4 = !{!"TotalCount", i64 10000} |
| 39 | +!5 = !{!"MaxCount", i64 200} |
| 40 | +!6 = !{!"MaxInternalCount", i64 200} |
| 41 | +!7 = !{!"MaxFunctionCount", i64 200} |
| 42 | +!8 = !{!"NumCounts", i64 3} |
| 43 | +!9 = !{!"NumFunctions", i64 3} |
| 44 | +!10 = !{!"DetailedSummary", !11} |
| 45 | +!11 = !{!12, !13, !14} |
| 46 | +!12 = !{i32 10000, i64 100, i32 1} |
| 47 | +!13 = !{i32 990000, i64 100, i32 1} |
| 48 | +!14 = !{i32 999999, i64 1, i32 2} |
| 49 | + |
| 50 | +!15 = !{!"function_entry_count", i32 150} |
| 51 | +; 1960855528937986108 is the MD5 hash of _ZTV4Base |
| 52 | +!16 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} |
| 53 | +; 5459407273543877811 is the MD5 hash of _ZN4Base4funcEv |
| 54 | +!17 = !{!"VP", i32 0, i64 1600, i64 5459407273543877811, i64 1600} |
| 55 | + |
| 56 | +; ModuleSummaryIndex stores <guid, global-value summary> map in std::map; so |
| 57 | +; global value summares are printed out in the order that gv's guid increases. |
| 58 | +; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0)) |
| 59 | +; DIS: ^1 = gv: (guid: 5459407273543877811) |
| 60 | +; DIS: ^2 = gv: (name: "_Z4testP4Base", summaries: (function: (module: ^0, flags: (linkage: external, visibility: default, notEligibleToImport: 0, live: 0, dsoLocal: 0, canAutoHide: 0), insts: 4, funcFlags: (readNone: 0, readOnly: 0, noRecurse: 0, returnDoesNotAlias: 0, noInline: 0, alwaysInline: 0, noUnwind: 0, mayThrow: 0, hasUnknownCall: 1, mustBeUnreachable: 0), calls: ((callee: ^1, hotness: hot))))) ; guid = 15857150948103218965 |
| 61 | +; DIS: ^3 = blockcount: 0 |
0 commit comments