-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[Profile] Add binary profile correlation for code coverage. #69493
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
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3a394ce
[Profile] Add binary profile correlation.
ZequanWu 7767844
fix correlator for coff.
ZequanWu c5cca07
update docs and renaming option
ZequanWu 44704f6
format
ZequanWu 384ee6c
add llvm-cov and IR test
ZequanWu fb20012
resolve conflict
ZequanWu 61775c7
resolve conflict
ZequanWu 37f5fc4
add missing DebugInfoCorrelate
ZequanWu 9f76629
Merge remote-tracking branch 'origin/main' into binary-correlate
ZequanWu 8fb0a77
Updated to use new section names `__llvm_covdata` and `__llvm_covname…
ZequanWu 1ee0053
fixup! format
ZequanWu f677688
Fix coff. Section names should be no greater than 8 bytes
ZequanWu 023a4a6
re-order macros in InstrProfData.inc so __llvm_cov* are together and …
ZequanWu a30427f
Merge branch 'main' into binary-correlate
ZequanWu 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,46 @@ | ||
// REQUIRES: linux || windows | ||
ZequanWu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
// Default | ||
// RUN: %clang -o %t.normal -fprofile-instr-generate -fcoverage-mapping %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp | ||
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.normal | ||
// RUN: llvm-profdata merge -o %t.normal.profdata %t.profraw | ||
// RUN: llvm-cov report --instr-profile=%t.normal.profdata %t.normal > %t.normal.report | ||
// RUN: llvm-cov show --instr-profile=%t.normal.profdata %t.normal > %t.normal.show | ||
|
||
// With -profile-correlate=binary flag | ||
// RUN: %clang -o %t-1.exe -fprofile-instr-generate -fcoverage-mapping -mllvm -profile-correlate=binary %S/Inputs/instrprof-debug-info-correlate-main.cpp %S/Inputs/instrprof-debug-info-correlate-foo.cpp | ||
// RUN: env LLVM_PROFILE_FILE=%t-1.profraw %run %t-1.exe | ||
// RUN: llvm-profdata merge -o %t-1.profdata --binary-file=%t-1.exe %t-1.profraw | ||
// RUN: llvm-cov report --instr-profile=%t-1.profdata %t-1.exe > %t-1.report | ||
// RUN: llvm-cov show --instr-profile=%t-1.profdata %t-1.exe > %t-1.show | ||
// RUN: diff %t.normal.profdata %t-1.profdata | ||
// RUN: diff %t.normal.report %t-1.report | ||
// RUN: diff %t.normal.show %t-1.show | ||
|
||
// Strip above binary and run | ||
// RUN: llvm-strip %t-1.exe -o %t-2.exe | ||
// RUN: env LLVM_PROFILE_FILE=%t-2.profraw %run %t-2.exe | ||
// RUN: llvm-profdata merge -o %t-2.profdata --binary-file=%t-1.exe %t-2.profraw | ||
// RUN: llvm-cov report --instr-profile=%t-2.profdata %t-1.exe > %t-2.report | ||
// RUN: llvm-cov show --instr-profile=%t-2.profdata %t-1.exe > %t-2.show | ||
// RUN: diff %t.normal.profdata %t-2.profdata | ||
// RUN: diff %t.normal.report %t-2.report | ||
// RUN: diff %t.normal.show %t-2.show | ||
|
||
// Online merging. | ||
// RUN: env LLVM_PROFILE_FILE=%t-3.profraw %run %t.normal | ||
// RUN: env LLVM_PROFILE_FILE=%t-4.profraw %run %t.normal | ||
// RUN: llvm-profdata merge -o %t.normal.merged.profdata %t-3.profraw %t-4.profraw | ||
// RUN: llvm-cov report --instr-profile=%t.normal.merged.profdata %t.normal > %t.normal.merged.report | ||
// RUN: llvm-cov show --instr-profile=%t.normal.merged.profdata %t.normal > %t.normal.merged.show | ||
|
||
// RUN: rm -rf %t.profdir && mkdir %t.profdir | ||
// RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe | ||
// RUN: env LLVM_PROFILE_FILE=%t.profdir/%m-4.profraw %run %t-2.exe | ||
// RUN: llvm-profdata merge -o %t-4.profdata --binary-file=%t-1.exe %t.profdir | ||
// RUN: llvm-cov report --instr-profile=%t-4.profdata %t-1.exe > %t-4.report | ||
// RUN: llvm-cov show --instr-profile=%t-4.profdata %t-1.exe > %t-4.show | ||
// RUN: diff %t.normal.merged.profdata %t-4.profdata | ||
// RUN: diff %t.normal.merged.report %t-4.report | ||
// RUN: diff %t.normal.merged.show %t-4.show | ||
|
||
// TODO: After adding support for binary ID, test binaries with different binary IDs. |
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
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
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.