(DRAFT) Combined draft branch for coverage work#115428
Closed
Zalathar wants to merge 13 commits intorust-lang:masterfrom
Closed
(DRAFT) Combined draft branch for coverage work#115428Zalathar wants to merge 13 commits intorust-lang:masterfrom
Zalathar wants to merge 13 commits intorust-lang:masterfrom
Conversation
Member
Author
|
@rustbot label +A-code-coverage +S-experimental |
Member
Author
|
@rustbot author |
d86423d to
40bd399
Compare
Member
Author
|
Quick summary of some of the changes I have queued up:
|
Collaborator
|
☔ The latest upstream changes (presumably #114843) made this pull request unmergeable. Please resolve the merge conflicts. |
1b1d270 to
efae00c
Compare
Member
Author
|
@rustbot label -A-testsuite -T-bootstrap |
56a3e06 to
27dbb3c
Compare
Collaborator
|
☔ The latest upstream changes (presumably #115671) made this pull request unmergeable. Please resolve the merge conflicts. |
f4a5170 to
741330a
Compare
51a3e7c to
1f016d8
Compare
Collaborator
|
☔ The latest upstream changes (presumably #115214) made this pull request unmergeable. Please resolve the merge conflicts. |
This query has a name that sounds general-purpose, but in fact it has coverage-specific semantics, and (fortunately) is only used by coverage code. Because it is only ever called once, it doesn't need to be a query, and we can change it to a regular function instead.
This test is mainly for detecting problems triggered by MIR optimizations, but the run-coverage tests don't enable optimization by default. (The coverage-map tests do enable optimization by default, but I'm updating the test anyway so that the two `unreachable.rs` files don't drift out of sync.)
…ters If a function has been instrumented for coverage, but MIR optimizations subsequently remove all of its counter-increment statements, then we won't emit LLVM counter-increment intrinsics. LLVM will think the function is not instrumented, and it will disappear from coverage mappings and coverage reports. This new MIR pass detects when that has happened, and re-inserts a dummy counter-increment statement so that LLVM knows to treat the function as instrumented.
…pings Most coverage metadata is encoded into two sections in the final executable. The `__llvm_covmap` section mostly just contains a list of filenames, while the `__llvm_covfun` section contains encoded coverage maps for each instrumented function. The catch is that each per-function record also needs to contain a hash of the filenames list that it refers to. Historically this was handled by assembling most of the per-function data into a temporary list, then assembling the filenames buffer, then using the filenames hash to emit the per-function data, and then finally emitting the filenames table itself. However, now that we build the filenames table up-front (via a separate traversal of the per-function data), we can hash and emit that part first, and then emit each of the per-function records immediately after building. This removes the awkwardness of having to temporarily store nearly-complete per-function records.
The code for creating these records was spread across multiple functions and multiple files, so this change moves as much of it as possible into one place.
Collaborator
|
☔ The latest upstream changes (presumably #116922) made this pull request unmergeable. Please resolve the merge conflicts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While waiting for #114843, juggling my patch queue is getting to be quite unwieldy, so I'm going to try putting all of my pending PRs (including some not filed yet) and some of my in-progress work in one linear branch.
r? @ghost