https://github.com/minglotus-6 updated https://github.com/llvm/llvm-project/pull/79363
>From 050c3889c3327ecec4add706fc7d593caa32bdb6 Mon Sep 17 00:00:00 2001 From: mingmingl <mingmi...@google.com> Date: Wed, 24 Jan 2024 13:46:47 -0800 Subject: [PATCH] polish test with profile-summary information Created using spr 1.3.4 --- .../thinlto-func-summary-vtableref-pgo.ll | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll index 375e3c290cc986d..78b175caca85f01 100644 --- a/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll +++ b/llvm/test/Bitcode/thinlto-func-summary-vtableref-pgo.ll @@ -10,32 +10,52 @@ ; CHECK-NEXT: <FLAGS op0=0/> ; The `VALUE_GUID` below represents the "_ZN4Base4funcEv" referenced by the ; indirect call instruction. -; CHECK-NEXT: <VALUE_GUID op0=8 op1=5459407273543877811/> +; CHECK-NEXT: <VALUE_GUID op0=17 op1=5459407273543877811/> ; <PERMODULE_PROFILE> has the format [valueid, flags, instcount, funcflags, ; numrefs, rorefcnt, worefcnt, ; n x (valueid, hotness+tailcall)] -; CHECK-NEXT: <PERMODULE_PROFILE abbrevid=4 op0=0 op1=0 op2=4 op3=256 op4=0 op5=0 op6=0 op7=8 op8=2/> +; CHECK-NEXT: <PERMODULE_PROFILE abbrevid=4 op0=0 op1=0 op2=4 op3=256 op4=0 op5=0 op6=0 op7=17 op8=3/> ; CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK> target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-unknown-linux-gnu" -define i32 @_Z4testP4Base(ptr %0) !prof !0 { - %2 = load ptr, ptr %0, !prof !1 +; Function has one BB and an entry count of 150, so the BB is hot according to +; ProfileSummary and reflected so in the bitcode (see llvm-dis output). +define i32 @_Z4testP4Base(ptr %0) !prof !15 { + %2 = load ptr, ptr %0, !prof !16 %3 = load ptr, ptr %2 - %4 = tail call i32 %3(ptr %0), !prof !2 + %4 = tail call i32 %3(ptr %0), !prof !17 ret i32 %4 } -!0 = !{!"function_entry_count", i32 150} +!llvm.module.flags = !{!1} + + +!1 = !{i32 1, !"ProfileSummary", !2} +!2 = !{!3, !4, !5, !6, !7, !8, !9, !10} +!3 = !{!"ProfileFormat", !"InstrProf"} +!4 = !{!"TotalCount", i64 10000} +!5 = !{!"MaxCount", i64 200} +!6 = !{!"MaxInternalCount", i64 200} +!7 = !{!"MaxFunctionCount", i64 200} +!8 = !{!"NumCounts", i64 3} +!9 = !{!"NumFunctions", i64 3} +!10 = !{!"DetailedSummary", !11} +!11 = !{!12, !13, !14} +!12 = !{i32 10000, i64 100, i32 1} +!13 = !{i32 990000, i64 100, i32 1} +!14 = !{i32 999999, i64 1, i32 2} + +!15 = !{!"function_entry_count", i32 150} ; 1960855528937986108 is the MD5 hash of _ZTV4Base -!1 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} +!16 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} ; 5459407273543877811 is the MD5 hash of _ZN4Base4funcEv -!2 = !{!"VP", i32 0, i64 1600, i64 5459407273543877811, i64 1600} +!17 = !{!"VP", i32 0, i64 1600, i64 5459407273543877811, i64 1600} ; ModuleSummaryIndex stores <guid, global-value summary> map in std::map; so ; global value summares are printed out in the order that gv's guid increases. ; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0)) ; DIS: ^1 = gv: (guid: 5459407273543877811) -; 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: none))))) ; guid = 15857150948103218965 +; 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 ; DIS: ^3 = blockcount: 0 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits