<feed xmlns='http://www.w3.org/2005/Atom'>
<title>rust/src/librustc_codegen_ssa/coverageinfo, branch try</title>
<subtitle>https://github.com/rust-lang/rust
</subtitle>
<id>http://git.dreamy.place/mirrors/rust/atom?h=try</id>
<link rel='self' href='http://git.dreamy.place/mirrors/rust/atom?h=try'/>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/'/>
<updated>2020-08-30T15:45:07+00:00</updated>
<entry>
<title>mv compiler to compiler/</title>
<updated>2020-08-30T15:45:07+00:00</updated>
<author>
<name>mark</name>
<email>markm@cs.wisc.edu</email>
</author>
<published>2020-08-28T03:58:48+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=9e5f7d5631b8f4009ac1c693e585d4b7108d4275'/>
<id>urn:sha1:9e5f7d5631b8f4009ac1c693e585d4b7108d4275</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Moved coverage counter injection from BasicBlock to Statement.</title>
<updated>2020-08-19T04:06:45+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-08-15T11:42:13+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=d129ac2655451ca894bceeb58a4d5c26a86c4caa'/>
<id>urn:sha1:d129ac2655451ca894bceeb58a4d5c26a86c4caa</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Completes support for coverage in external crates</title>
<updated>2020-08-04T18:06:54+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-08-02T03:03:59+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=e0dc8dec273b4cba44a91c1b4433e3dcd117919f'/>
<id>urn:sha1:e0dc8dec273b4cba44a91c1b4433e3dcd117919f</id>
<content type='text'>
The prior PR corrected for errors encountered when trying to generate
the coverage map on source code inlined from external crates (including
macros and generics) by avoiding adding external DefIds to the coverage
map.

This made it possible to generate a coverage report including external
crates, but the external crate coverage was incomplete (did not include
coverage for the DefIds that were eliminated.

The root issue was that the coverage map was converting Span locations
to source file and locations, using the SourceMap for the current crate,
and this would not work for spans from external crates (compliled with a
different SourceMap).

The solution was to convert the Spans to filename and location during
MIR generation instead, so precompiled external crates would already
have the correct source code locations embedded in their MIR, when
imported into another crate.
</content>
</entry>
<entry>
<title>Rust function-level coverage now works on external crates</title>
<updated>2020-07-30T19:25:39+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-30T19:25:39+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=34b26d6a77c45776cbbef182b4c1b0b96ac326fe'/>
<id>urn:sha1:34b26d6a77c45776cbbef182b4c1b0b96ac326fe</id>
<content type='text'>
Fixed a known issue in the coverage map where some regions had
nonsensical source code locations. External crate functions are already
included in their own coverage maps, per library, and don't need to also
be added to the importing crate's coverage map. (In fact, their source
start and end byte positions are not relevant to the importing crate's
SourceMap.)

The fix was to simply skip trying to add imported coverage info to the
coverage map if the instrumented function is not "local".

The injected counters are still relevant, however, and the LLVM
`instrprof.increment` intrinsic call parameters will map those counters
to the external crates' coverage maps, when generating runtime coverage
data.
</content>
</entry>
<entry>
<title>Moved structs/enums with repr(C) to LLVM types into ffi.rs crates</title>
<updated>2020-07-29T15:22:17+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-29T06:09:16+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5b2e2b25e41afbbd0ad803f7986d8559ef649a7e'/>
<id>urn:sha1:5b2e2b25e41afbbd0ad803f7986d8559ef649a7e</id>
<content type='text'>
Some were in librustc_codegen_llvm, but others are not tied to LLVM, so
I put them in a new crate: librustc_codegen_ssa/coverageinfo/ffi.rs
</content>
</entry>
<entry>
<title>FunctionCoverage: improve type checking with newtype_index types</title>
<updated>2020-07-29T00:45:58+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-29T00:45:58+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=b58afc088f34341cdffad8d12bf1a13331ff7deb'/>
<id>urn:sha1:b58afc088f34341cdffad8d12bf1a13331ff7deb</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Refactor MIR coverage instrumentation</title>
<updated>2020-07-28T22:08:19+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-27T23:25:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=20f55c193dea0a893c869dd7a9cf3e2298635221'/>
<id>urn:sha1:20f55c193dea0a893c869dd7a9cf3e2298635221</id>
<content type='text'>
Lays a better foundation for injecting more counters in each function.
</content>
</entry>
<entry>
<title>Fixed coverage map issues; better aligned with LLVM APIs</title>
<updated>2020-07-25T14:39:51+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-25T04:14:28+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=12ddd6073abecb7a515a43bee37408596e322345'/>
<id>urn:sha1:12ddd6073abecb7a515a43bee37408596e322345</id>
<content type='text'>
Found some problems with the coverage map encoding when testing with
more than one counter per function.

While debugging, I realized some better ways to structure the Rust
implementation of the coverage mapping generator. I refactored somewhat,
resulting in less code overall, expanded coverage of LLVM Coverage Map
capabilities, and much closer alignment with LLVM data structures, APIs,
and naming.

This should be easier to follow and easier to maintain.
</content>
</entry>
<entry>
<title>Generating the coverage map</title>
<updated>2020-07-17T18:49:35+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-07-02T18:27:15+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=a6f8b8a2116f0ea7e31d572d3120508678ed8079'/>
<id>urn:sha1:a6f8b8a2116f0ea7e31d572d3120508678ed8079</id>
<content type='text'>
rustc now generates the coverage map and can support (limited)
coverage report generation, at the function level.

Example:

$ BUILD=$HOME/rust/build/x86_64-unknown-linux-gnu
$ $BUILD/stage1/bin/rustc -Zinstrument-coverage \
$HOME/rust/src/test/run-make-fulldeps/instrument-coverage/main.rs
$ LLVM_PROFILE_FILE="main.profraw" ./main
called
$ $BUILD/llvm/bin/llvm-profdata merge -sparse main.profraw -o main.profdata
$ $BUILD/llvm/bin/llvm-cov show --instr-profile=main.profdata main
    1|      1|pub fn will_be_called() {
    2|      1|    println!("called");
    3|      1|}
    4|       |
    5|      0|pub fn will_not_be_called() {
    6|      0|    println!("should not have been called");
    7|      0|}
    8|       |
    9|      1|fn main() {
   10|      1|    let less = 1;
   11|      1|    let more = 100;
   12|      1|
   13|      1|    if less &lt; more {
   14|      1|        will_be_called();
   15|      1|    } else {
   16|      1|        will_not_be_called();
   17|      1|    }
   18|      1|}
</content>
</entry>
<entry>
<title>add spans to injected coverage counters</title>
<updated>2020-06-29T19:31:25+00:00</updated>
<author>
<name>Rich Kadel</name>
<email>richkadel@google.com</email>
</author>
<published>2020-06-22T06:29:08+00:00</published>
<link rel='alternate' type='text/html' href='http://git.dreamy.place/mirrors/rust/commit/?id=5239a68e72d1a0c7cba2cfd219a7da911360fbb7'/>
<id>urn:sha1:5239a68e72d1a0c7cba2cfd219a7da911360fbb7</id>
<content type='text'>
added regions with counter expressions and counters.

Added codegen_llvm/coverageinfo mod for upcoming coverage map

Move coverage region collection to CodegenCx finalization

Moved from `query coverageinfo` (renamed from `query coverage_data`),
as discussed in the PR at:

https://github.com/rust-lang/rust/pull/73684#issuecomment-649882503

Address merge conflict in MIR instrument_coverage test

The MIR test output format changed for int types.

moved debug messages out of block.rs

This makes the block.rs calls to add coverage mapping data to the
CodegenCx much more concise and readable.

move coverage intrinsic handling into llvm impl

I realized that having half of the coverage intrinsic handling in
`rustc_codegen_ssa` and half in `rustc_codegen_llvm` meant that any
non-llvm backend would be bound to the same decisions about how the
coverage-related MIR terminators should be handled.

To fix this, I moved the non-codegen portion of coverage intrinsic
handling into its own trait, and implemented it in `rustc_codegen_llvm`
alongside `codegen_intrinsic_call`.

I also added the (required?) stubs for the new intrinsics to
`IntrepretCx::emulate_intrinsic()`, to ensure calls to this function do
not fail if called with these new but known intrinsics.

address PR Feedback on 28 June 2020 2:48pm PDT
</content>
</entry>
</feed>
