Skip to content

Commit 84467e0

Browse files
committed
Adds a dev guide section on Rust Coverage
1 parent af2aa99 commit 84467e0

7 files changed

+628
-1
lines changed

src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
- [Backend Agnostic Codegen](./backend/backend-agnostic.md)
148148
- [Implicit Caller Location](./backend/implicit-caller-location.md)
149149
- [Profile-guided Optimization](./profile-guided-optimization.md)
150+
- [LLVM Source-Based Code Coverage](./llvm-coverage-instrumentation.md)
150151
- [Sanitizers Support](./sanitizers.md)
151152
- [Debugging Support in the Rust Compiler](./debugging-support-in-rustc.md)
152153

11 KB
Loading

src/img/coverage-graphviz-01.png

332 KB
Loading

src/img/coverage-spanview-01.png

313 KB
Loading

src/img/llvm-cov-show-01.png

407 KB
Loading

src/llvm-coverage-instrumentation.md

+620
Large diffs are not rendered by default.

src/profile-guided-optimization.md

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ LLVM actually [supports multiple forms][clang-pgo] of PGO:
2929
- GCOV-based profiling, where code coverage infrastructure is used to collect
3030
profiling information.
3131
- Front-end based instrumentation, where the compiler front-end (e.g. Clang)
32-
inserts instrumentation intrinsics into the LLVM IR it generates.
32+
inserts instrumentation intrinsics into the LLVM IR it generates (but see the
33+
[^note-instrument-coverage]"Note").
3334
- IR-level instrumentation, where LLVM inserts the instrumentation intrinsics
3435
itself during optimization passes.
3536

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

48+
[^note-instrument-coverage]: Note: `rustc` now supports front-end-based coverage
49+
instrumentation, via the experimental option
50+
[`-Z instrument-coverage`](../llvm-coverage-instrumentation), but using these
51+
coverage results for PGO has not been attempted at this time.
52+
4753
### Overall Workflow
4854

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

0 commit comments

Comments
 (0)