-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[MemProf] Attach value profile metadata to the IR using CalleeGuids. #141164
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
Merged
snehasish
merged 10 commits into
main
from
users/snehasish/05-22-_memprof_attach_value_profile_metadata_to_the_ir_using_calleeguids
May 31, 2025
Merged
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2858bad
[MemProf] Attach value profile metadata to the IR using CalleeGuids.
da9b985
Add an option to toggle application of CalleeGuids.
c31f858
Fix formatting.
cd8536a
Handle pre-existing vp metadata.
e7dbf78
Efficient callsite lookup and refactoring.
918d650
Make the flag false by default and update the tests.
85ed751
Undo unrelated change.
ca1cc24
Combine tests into a single file.
a6283e7
Address comments.
2310c53
Address review comment: change ~0U to 1 for efficiency
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 hidden or 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: 37 additions & 0 deletions
37
llvm/test/Transforms/PGOProfile/memprof_annotate_indirect_call_yaml.test
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| ; Make sure that we can ingest the MemProf profile in YAML with CalleeGuids | ||
| ; and annotate an indirect call with value profile metadata. | ||
|
|
||
| ; RUN: split-file %s %t | ||
| ; RUN: llvm-profdata merge --memprof-version=4 %t/memprof_annotate_indirect_call_yaml.yaml -o %t/memprof_annotate_indirect_call_yaml.memprofdata | ||
| ; RUN: opt < %t/memprof_annotate_indirect_call_yaml.ll -passes='memprof-use<profile-filename=%t/memprof_annotate_indirect_call_yaml.memprofdata>' -S 2>&1 | FileCheck %s | ||
|
|
||
| ;--- memprof_annotate_indirect_call_yaml.yaml | ||
| --- | ||
| HeapProfileRecords: | ||
| - GUID: _Z3barv | ||
| AllocSites: [] | ||
| CallSites: | ||
| - Frames: | ||
| - { Function: _Z3barv, LineOffset: 3, Column: 5, IsInlineFrame: false } | ||
| CalleeGuids: [0x123456789abcdef0, 0x23456789abcdef01] | ||
| ... | ||
| ;--- memprof_annotate_indirect_call_yaml.ll | ||
| define dso_local void @_Z3barv() !dbg !4 { | ||
| entry: | ||
| %fp = alloca ptr, align 8 | ||
| %0 = load ptr, ptr %fp, align 8 | ||
| call void %0(), !dbg !5 | ||
| ; CHECK: call void %0(), {{.*}} !prof ![[PROF:[0-9]+]] | ||
| ret void | ||
| } | ||
|
|
||
| ; CHECK: ![[PROF]] = !{!"VP", i32 0, i64 2, i64 1311768467463790320, i64 1, i64 2541551405711093505, i64 1} | ||
|
|
||
| !llvm.module.flags = !{!2, !3} | ||
|
|
||
| !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1) | ||
| !1 = !DIFile(filename: "t", directory: "/") | ||
| !2 = !{i32 7, !"Dwarf Version", i32 5} | ||
| !3 = !{i32 2, !"Debug Info Version", i32 3} | ||
| !4 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 1, unit: !0) | ||
| !5 = !DILocation(line: 4, column: 5, scope: !4) |
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.
Nit: remove braces around single line body
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.
Done.