-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[BOLT] Hash-based function matching #95821
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
shawbyoung
merged 25 commits into
main
from
users/shawbyoung/spr/bolt-hash-based-function-matching
Jun 24, 2024
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
def7dae
[𝘀𝗽𝗿] initial version
shawbyoung 9452bd5
[𝘀𝗽𝗿] changes to main this commit is based on
sayhaan 92212c9
spr amend
shawbyoung 2497922
spr amend
shawbyoung 8e7b222
spr amend
shawbyoung ef5f0da
spr amend
shawbyoung 41ce289
spr amend
shawbyoung 99cf891
spr amend
shawbyoung e11820f
spr amend
shawbyoung 83858e2
spr amend
shawbyoung 7387126
spr amend
shawbyoung baec71c
spr amend
shawbyoung ff68ace
spr amend
shawbyoung ef2eaaa
spr amend
shawbyoung 3ed600c
spr amend
shawbyoung 4b13659
spr amend
shawbyoung 0c18b86
spr amend
shawbyoung eb6cb88
spr amend
shawbyoung a2c9c82
spr amend
shawbyoung 4e1b758
spr amend
shawbyoung f2ba96a
spr amend
shawbyoung 6a56188
Drop end of line
shawbyoung 5b83e65
[𝘀𝗽𝗿] changes introduced through rebase
shawbyoung 99dff77
Added documentation
shawbyoung 47c4cd5
Merge branch 'main' into users/shawbyoung/spr/bolt-hash-based-functio…
shawbyoung 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
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
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
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
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,64 @@ | ||
## Tests function matching in YAMLProfileReader by function hash. | ||
|
||
# REQUIRES: system-linux | ||
# RUN: split-file %s %t | ||
# RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %t/main.s -o %t.o | ||
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib | ||
# RUN: llvm-bolt %t.exe -o %t.out --data %t/yaml -v=2 \ | ||
# RUN: --print-cfg --match-profile-with-function-hash 2>&1 --profile-ignore-hash=0 | FileCheck %s | ||
|
||
# CHECK: BOLT-INFO: matched 1 functions with hash | ||
|
||
#--- main.s | ||
.globl main | ||
.type main, @function | ||
main: | ||
.cfi_startproc | ||
.LBB00: | ||
pushq %rbp | ||
movq %rsp, %rbp | ||
subq $16, %rsp | ||
testq %rax, %rax | ||
js .LBB03 | ||
.LBB01: | ||
jne .LBB04 | ||
.LBB02: | ||
nop | ||
.LBB03: | ||
xorl %eax, %eax | ||
addq $16, %rsp | ||
popq %rbp | ||
retq | ||
.LBB04: | ||
xorl %eax, %eax | ||
addq $16, %rsp | ||
popq %rbp | ||
retq | ||
## For relocations against .text | ||
.LBB05: | ||
call exit | ||
.cfi_endproc | ||
.size main, .-main | ||
|
||
#--- yaml | ||
--- | ||
header: | ||
profile-version: 1 | ||
binary-name: 'hashing-based-function-matching.s.tmp.exe' | ||
binary-build-id: '<unknown>' | ||
profile-flags: [ lbr ] | ||
profile-origin: branch profile reader | ||
profile-events: '' | ||
dfs-order: false | ||
hash-func: xxh3 | ||
functions: | ||
- name: main2 | ||
fid: 0 | ||
hash: 0x72F82DEAA6FE65FB | ||
exec: 1 | ||
nblocks: 6 | ||
blocks: | ||
- bid: 1 | ||
insns: 1 | ||
succ: [ { bid: 3, cnt: 1} ] | ||
... |
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.
Uh oh!
There was an error while loading. Please reload this page.