Skip to content

Commit b2f5677

Browse files
committed
sembr src/llvm-coverage-instrumentation.md
1 parent ccc334e commit b2f5677

1 file changed

Lines changed: 10 additions & 12 deletions

File tree

src/llvm-coverage-instrumentation.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ libraries and binaries with additional instructions and data, at compile time.
77
The coverage instrumentation injects calls to the LLVM intrinsic instruction
88
[`llvm.instrprof.increment`][llvm-instrprof-increment] at code branches
99
(based on a MIR-based control flow analysis), and LLVM converts these to
10-
instructions that increment static counters, when executed. The LLVM coverage
11-
instrumentation also requires a [Coverage Map] that encodes source metadata,
10+
instructions that increment static counters, when executed.
11+
The LLVM coverage instrumentation also requires a [Coverage Map] that encodes source metadata,
1212
mapping counter IDs--directly and indirectly--to the file locations (with
1313
start and end line and column).
1414

15-
Rust libraries, with or without coverage instrumentation, can be linked into
16-
instrumented binaries. When the program is executed and cleanly terminates,
15+
Rust libraries, with or without coverage instrumentation, can be linked into instrumented binaries.
16+
When the program is executed and cleanly terminates,
1717
LLVM libraries write the final counter values to a file (`default.profraw` or
1818
a custom file set through environment variable `LLVM_PROFILE_FILE`).
1919

@@ -22,8 +22,7 @@ files, with corresponding Coverage Maps (from matching binaries that produced
2222
them), and generate various reports for analysis, for example:
2323

2424
<img alt="Screenshot of sample `llvm-cov show` result, for function add_quoted_string"
25-
src="img/llvm-cov-show-01.png" class="center"/>
26-
<br/>
25+
src="img/llvm-cov-show-01.png" class="center"/> <br/>
2726

2827
Detailed instructions and examples are documented in the
2928
[rustc book][rustc-book-instrument-coverage].
@@ -39,8 +38,7 @@ When working on the coverage instrumentation code, it is usually necessary to
3938
This allows the compiler to produce instrumented binaries, and makes it possible
4039
to run the full coverage test suite.
4140

42-
Enabling debug assertions in the compiler and in LLVM is recommended, but not
43-
mandatory.
41+
Enabling debug assertions in the compiler and in LLVM is recommended, but not mandatory.
4442

4543
```toml
4644
# Similar to the "compiler" profile, but also enables debug assertions in LLVM.
@@ -60,8 +58,8 @@ rust.debug-assertions = true
6058

6159
`-C instrument-coverage` automatically enables Rust symbol mangling `v0` (as
6260
if the user specified `-C symbol-mangling-version=v0` option when invoking
63-
`rustc`) to ensure consistent and reversible name mangling. This has two
64-
important benefits:
61+
`rustc`) to ensure consistent and reversible name mangling.
62+
This has two important benefits:
6563

6664
1. LLVM coverage tools can analyze coverage over multiple runs, including some
6765
changes to source code; so mangled names must be consistent across compilations.
@@ -71,8 +69,8 @@ important benefits:
7169

7270
## The LLVM profiler runtime
7371

74-
Coverage data is only generated by running the executable Rust program. `rustc`
75-
statically links coverage-instrumented binaries with LLVM runtime code
72+
Coverage data is only generated by running the executable Rust program.
73+
`rustc` statically links coverage-instrumented binaries with LLVM runtime code
7674
([compiler-rt][compiler-rt-profile]) that implements program hooks
7775
(such as an `exit` hook) to write the counter values to the `.profraw` file.
7876

0 commit comments

Comments
 (0)