-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[Coverage][MCDC] Group mcdc tests and fix panic when generating mcdc code for inlined expressions. #127234
Conversation
r? @davidtwco rustbot has assigned @davidtwco. Use |
@rustbot label +A-code-coverage |
7d1d52e
to
49e8e2d
Compare
Unfortunately, I'm pretty sure this fix is wrong. We can't just call For example, what happens if a function is inlined in multiple places, or is both inlined and also codegenned as a non-inlined function? It looks like only some of those places will end up with the local variables that they need. For now, I think the workaround should just be to completely disable MIR inlining when MC/DC is enabled. |
By the way, if you want to extract the first two patches (adjusting tests) to their own PR, they should be fine. (I can't directly approve them myself, but I can at least tell the assigned reviewer that they're OK.) |
Something like this in impl<'tcx> MirPass<'tcx> for Inline {
fn is_enabled(&self, sess: &rustc_session::Session) -> bool {
// FIXME(#127234): Coverage instrumentation currently doesn't handle inlined
// MIR correctly when Modified Condition/Decision Coverage is enabled.
if sess.instrument_coverage_mcdc() {
return false;
} |
How about use |
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
Updated. Considering there might be much overhead if we created mcdc parameters for each inlined functions separately, disable inlining when mcdc is enabled seems better for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. r=me but would like to confirm that @Zalathar is happy with it, knowing coverage more than I do.
@davidtwco Yes, r+ from me also. 👍 |
No change in the force push. I just rebase it to the latest master. |
@bors r=davidtwco,Zalathar |
☀️ Test successful - checks-actions |
Finished benchmarking commit (6be96e3): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis benchmark run did not return any relevant results for this metric. Max RSS (memory usage)This benchmark run did not return any relevant results for this metric. CyclesResults (secondary -2.1%)This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.
Binary sizeThis benchmark run did not return any relevant results for this metric. Bootstrap: 702.397s -> 703.661s (0.18%) |
Changes
CoverageInfoBuilderMethods::init_coverage
for inlined functions. As a result, it could panic if it tries to instrument mcdc statements for inlined functions due to uninitialized cond bitmaps. We can reproduce this issue by current nightly rustc and the test with flag--release
. This patch fixes it.