Skip to content
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

Adds a dev guide section on Rust Coverage #985

Merged
merged 1 commit into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
- [Backend Agnostic Codegen](./backend/backend-agnostic.md)
- [Implicit Caller Location](./backend/implicit-caller-location.md)
- [Profile-guided Optimization](./profile-guided-optimization.md)
- [LLVM Source-Based Code Coverage](./llvm-coverage-instrumentation.md)
- [Sanitizers Support](./sanitizers.md)
- [Debugging Support in the Rust Compiler](./debugging-support-in-rustc.md)

Expand Down
Binary file added src/img/coverage-branch-counting-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/coverage-graphviz-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/coverage-spanview-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/img/llvm-cov-show-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
627 changes: 627 additions & 0 deletions src/llvm-coverage-instrumentation.md

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/profile-guided-optimization.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ LLVM actually [supports multiple forms][clang-pgo] of PGO:
- GCOV-based profiling, where code coverage infrastructure is used to collect
profiling information.
- Front-end based instrumentation, where the compiler front-end (e.g. Clang)
inserts instrumentation intrinsics into the LLVM IR it generates.
inserts instrumentation intrinsics into the LLVM IR it generates (but see the
[^note-instrument-coverage]"Note").
- IR-level instrumentation, where LLVM inserts the instrumentation intrinsics
itself during optimization passes.

Expand All @@ -44,6 +45,11 @@ optimized. Instrumentation-based PGO has two components: a compile-time
component and run-time component, and one needs to understand the overall
workflow to see how they interact.

[^note-instrument-coverage]: Note: `rustc` now supports front-end-based coverage
instrumentation, via the experimental option
[`-Z instrument-coverage`](../llvm-coverage-instrumentation), but using these
coverage results for PGO has not been attempted at this time.

### Overall Workflow

Generating a PGO-optimized program involves the following four steps:
Expand Down