-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ThinLTO][TypeProfiling]Add annotated vtable GUID as referenced variables in per function summary, and update bitcode writer to create value-ids for these referenced vtables #79234
Closed
mingmingl-llvm
wants to merge
2
commits into
users/minglotus-6/spr/main.thinltotypeprofilingadd-annotated-vtable-guid-as-referenced-variables-in-per-function-summary-and-update-bitcode-writer-to-create-value-ids-for-these-referenced-vtables
from
users/minglotus-6/spr/thinltotypeprofilingadd-annotated-vtable-guid-as-referenced-variables-in-per-function-summary-and-update-bitcode-writer-to-create-value-ids-for-these-referenced-vtables
+101
−42
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 18 additions & 19 deletions
37
llvm/test/Bitcode/thinlto-function-summary-vtableref-pgo.ll
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,40 @@ | ||
; RUN: opt -module-summary %s -o %t.o | ||
|
||
; RUN: llvm-bcanalyzer -dump %t.o | FileCheck %s | ||
; RUN llvm-bcanalyzer -dump %t.o | FileCheck %s | ||
|
||
; RUN: llvm-dis -o - %t.o | FileCheck %s --check-prefix=DIS | ||
|
||
; Round trip it through llvm-as | ||
; RUN: llvm-dis -o - %t.o | llvm-as -o - | llvm-dis -o - | FileCheck %s --check-prefix=DIS | ||
|
||
; CHECK: <GLOBALVAL_SUMMARY_BLOCK | ||
; CHECK-NEXT: <VERSION op0=9/> | ||
; 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/> | ||
; <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/> | ||
; "_ZTV4Base" referenced by the instruction that loads vtable from object. | ||
; CHECK-NEXT: <VALUE_GUID op0=8 op1=1960855528937986108/> | ||
; "_ZN4Base4funcEv" referenced by the indirect call instruction. | ||
; CHECK-NEXT: <VALUE_GUID op0=7 op1=5459407273543877811/> | ||
; CHECK-NEXT: <PERMODULE abbrevid=5 op0=0 op1=0 op2=4 op3=256 op4=1 op5=1 op6=0 op7=8 op8=7/> | ||
; 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 | ||
define i32 @_Z4testP4Base(ptr %0) { | ||
%2 = load ptr, ptr %0, !prof !0 | ||
%3 = load ptr, ptr %2 | ||
%4 = tail call i32 %3(ptr %0), !prof !2 | ||
%4 = tail call i32 %3(ptr %0), !prof !1 | ||
ret i32 %4 | ||
} | ||
|
||
!0 = !{!"function_entry_count", i32 150} | ||
; 1960855528937986108 is the MD5 hash of _ZTV4Base | ||
!1 = !{!"VP", i32 2, i64 1600, i64 1960855528937986108, i64 1600} | ||
!0 = !{!"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} | ||
!1 = !{!"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: "/usr/local/google/home/mingmingl/llvm-fork/llvm-project/build/test/Bitcode/Output/thinlto-function-summary-vtableref-pgo.ll.tmp.o", 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: ^3 = blockcount: 0 | ||
; DIS: ^0 = module: (path: "{{.*}}", hash: (0, 0, 0, 0, 0)) | ||
; DIS-NEXT: ^1 = gv: (guid: 1960855528937986108) | ||
; DIS-NEXT: ^2 = gv: (guid: 5459407273543877811) | ||
; DIS-NEXT: ^3 = 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: ^2, hotness: none)), refs: (readonly ^1)))) ; guid = 15857150948103218965 | ||
; DIS-NEXT: ^4 = blockcount: 0 |
You are viewing a condensed version of this merge commit. You can view the full changes here.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A precommit test case is in #79233, to showcase the diff clearer.