-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[BOLT] Set call to continuation count in pre-aggregated profile #109486
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
aaupov
merged 12 commits into
main
from
users/aaupov/spr/bolttest-add-callcont-fallthrutest
Nov 8, 2024
+215
−35
Merged
Changes from 8 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e713939
[𝘀𝗽𝗿] initial version
aaupov 5f48b92
repurpose for the fix of call cont discontinuity
aaupov 9741297
clang-format
aaupov 9c4effa
Drop changes in doTrace/getFallthroughsInTrace
aaupov 9e4dd66
Handle external origin LBR (non-BAT mode)
aaupov 06fe34d
Added plt call (return from external location) test case
aaupov e8ec9c9
Add test for getFallthroughsInTrace
aaupov 9ac54dd
Use return profile conversion for pre-aggregated profile only
aaupov a8e1c54
address comments
aaupov 94991b2
Drop call check
aaupov 9b3db9b
Drop = from comment
aaupov b23bdb2
clang-format
aaupov 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| ## Ensures that a call continuation fallthrough count is set when using | ||
| ## pre-aggregated perf data. | ||
|
|
||
| # RUN: llvm-mc -filetype=obj -triple x86_64-unknown-unknown %s -o %t.o | ||
| # RUN: %clang %cflags %t.o -o %t.exe -Wl,-q -nostdlib | ||
| # RUN: link_fdata %s %t.exe %t.pa PREAGG | ||
| # RUN: link_fdata %s %t.exe %t.pa2 PREAGG2 | ||
| # RUN: llvm-strip --strip-unneeded %t.exe | ||
| # RUN: llvm-bolt %t.exe --pa -p %t.pa -o %t.out \ | ||
| # RUN: --print-cfg --print-only=main | FileCheck %s | ||
|
|
||
| ## Check that getFallthroughsInTrace correctly handles a trace starting at plt | ||
| ## call continuation | ||
| # RUN: llvm-bolt %t.exe --pa -p %t.pa2 -o %t.out2 \ | ||
| # RUN: --print-cfg --print-only=main | FileCheck %s --check-prefix=CHECK2 | ||
|
|
||
| .globl foo | ||
| .type foo, %function | ||
| foo: | ||
| pushq %rbp | ||
| movq %rsp, %rbp | ||
| popq %rbp | ||
| Lfoo_ret: | ||
| retq | ||
| .size foo, .-foo | ||
|
|
||
| .globl main | ||
| .type main, %function | ||
| main: | ||
| pushq %rbp | ||
| movq %rsp, %rbp | ||
| subq $0x20, %rsp | ||
| movl $0x0, -0x4(%rbp) | ||
| movl %edi, -0x8(%rbp) | ||
| movq %rsi, -0x10(%rbp) | ||
| callq puts@PLT | ||
| # PREAGG: B X:0 #Ltmp1# 2 0 | ||
| # CHECK: callq puts@PLT | ||
| # CHECK-NEXT: count: 2 | ||
|
|
||
| # CHECK2: callq puts@PLT | ||
| # CHECK2-NEXT: count: 0 | ||
|
|
||
| Ltmp1: | ||
| movq -0x10(%rbp), %rax | ||
| movq 0x8(%rax), %rdi | ||
| movl %eax, -0x14(%rbp) | ||
|
|
||
| Ltmp4: | ||
| cmpl $0x0, -0x14(%rbp) | ||
| je Ltmp0 | ||
| # CHECK2: je .Ltmp0 | ||
| # CHECK2-NEXT: count: 3 | ||
|
|
||
| movl $0xa, -0x18(%rbp) | ||
| callq foo | ||
| # PREAGG: B #Lfoo_ret# #Ltmp3# 1 0 | ||
| # CHECK: callq foo | ||
| # CHECK-NEXT: count: 1 | ||
|
|
||
| # PREAGG2: F #Ltmp1# #Ltmp3_br# 3 | ||
| # CHECK2: callq foo | ||
| # CHECK2-NEXT: count: 3 | ||
|
|
||
| Ltmp3: | ||
| cmpl $0x0, -0x18(%rbp) | ||
| Ltmp3_br: | ||
| jmp Ltmp2 | ||
|
|
||
| Ltmp2: | ||
| movl -0x18(%rbp), %eax | ||
| addl $-0x1, %eax | ||
| movl %eax, -0x18(%rbp) | ||
| jmp Ltmp3 | ||
| jmp Ltmp4 | ||
| jmp Ltmp1 | ||
|
|
||
| Ltmp0: | ||
| xorl %eax, %eax | ||
| addq $0x20, %rsp | ||
| popq %rbp | ||
| retq | ||
| .size main, .-main |
Oops, something went wrong.
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.