Skip to content

Commit

Permalink
Adds a dev guide section on Rust Coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
richkadel committed Dec 7, 2020
1 parent af2aa99 commit 30da3ed
Show file tree
Hide file tree
Showing 7 changed files with 635 additions and 1 deletion.
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

0 comments on commit 30da3ed

Please sign in to comment.