-
Notifications
You must be signed in to change notification settings - Fork 13.3k
WIP: Injects counters before every block (experimental only) #74856
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
Lays a better foundation for injecting more counters in each function.
Uses the span from the start of the first statement to the end of the Terminator. Includes "cleanup" subgraphs. This simple approach does introduce some poor coverage results. For example, a function that only calls macros (like `println!`, for example) may only have counters injected at the macro site, and these may never get counted, for some reason. (I'm seeing some functions with coverage counts of zero, even though they clearly should be called.) I'm developing a follow-up change to this one that injects counters more precisely, by inspecting the Statement and Terminator types, and making different decisions regarding what blocks should be counted, and what spans to use to generate the code regions.
(rust_highfive has picked a reviewer for you, use r? to override) |
r? @tmandry |
@tmandry - I tried to push a specific commit on the branch, but got other commits, including future changes. Ignore this PR for now (it's draft anyway), and I'll add a note when it's ready to take a look at. Thanks! |
5f518f5
to
ec050f2
Compare
@tmandry - Fixed. You can see the changes specific to this PR in the last commit. (The first 2 commits are from the PR currently in review.) This is just what you looked at yesterday during our meeting, simply adding counters to each As discussed, I'll do some more investigating of And as noted, I may also push a parallel PR with the work I did to be more selective about which |
☔ The latest upstream changes (presumably #74837) made this pull request unmergeable. Please resolve the merge conflicts. |
@richkadel if you rebase and resolve the latest conflicts, we can get this reviewed if possible |
The gist of this PR is incorporated in #75828 instead. |
Uses the span from the start of the first statement to the end of the Terminator.
This simple approach does introduce some poor coverage results. For
example, a function that only calls macros (like
println!
, forexample) may only have counters injected at the macro site, and these
may never get counted, for some reason. (I'm seeing some functions with
coverage counts of zero, even though they clearly should be called.)
I'm developing a follow-up change to this one that injects counters more
precisely, by inspecting the Statement and Terminator types, and making
different decisions regarding what blocks should be counted, and what
spans to use to generate the code regions.