-
Notifications
You must be signed in to change notification settings - Fork 13k
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: Store coverage source regions as Span
until codegen (take 2)
#134497
Conversation
This will avoid confusion with actual `Span` spans.
In codegen, a used function with `FunctionCoverageInfo` but no mappings has historically indicated a bug. However, that will no longer be the case after moving some fallible span-processing steps into codegen.
Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt |
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.
The implementation looks good to me, and I'm in favoring of making this change. Not having a regression test makes me a bit nervous, but unless we are able to minimize an example that we can use as a regression test (i.e. not a full-blown giant project), I don't think that is super actionable. I think we'll need to find out in nightly if anyone runs into the original problem again, because regardless of making this change or not, I think we do want an MCVE for the original ICE. Furthermore, I think the only way we might be able to minimize one is from more examples. EDIT: we now have a synthetic test example.
Just one question.
Span
until codegen (take 2)
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.
The test changes LGTM, you can r=me after PR CI is green.
I can confirm that if I backport the new test to the point just after #133418 was merged, and do (We don't know for sure that it's the same error, because llvm-cov's error reporting for malformed data is really bad, but it's good enough to convince me that the test is doing its job.) |
It's as good as we're going to get, without nudging llvm-cov to produce better diagnostics. |
🟩 @bors r=jieyouxu |
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134463 (compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes) - rust-lang#134487 (Add reference annotations for the `coverage` attribute) - rust-lang#134497 (coverage: Store coverage source regions as `Span` until codegen (take 2)) - rust-lang#134502 (Update std libc version to 0.2.169) - rust-lang#134506 (Remove a duplicated check that doesn't do anything anymore.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134463 (compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes) - rust-lang#134487 (Add reference annotations for the `coverage` attribute) - rust-lang#134497 (coverage: Store coverage source regions as `Span` until codegen (take 2)) - rust-lang#134502 (Update std libc version to 0.2.169) - rust-lang#134506 (Remove a duplicated check that doesn't do anything anymore.) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#134463 (compiletest: don't register predefined `MSVC`/`NONMSVC` FileCheck prefixes) - rust-lang#134487 (Add reference annotations for the `coverage` attribute) - rust-lang#134497 (coverage: Store coverage source regions as `Span` until codegen (take 2)) - rust-lang#134502 (Update std libc version to 0.2.169) - rust-lang#134506 (Remove a duplicated check that doesn't do anything anymore.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134497 - Zalathar:spans, r=jieyouxu coverage: Store coverage source regions as `Span` until codegen (take 2) This is an attempt to re-land rust-lang#133418: > Historically, coverage spans were converted into line/column coordinates during the MIR instrumentation pass. > This PR moves that conversion step into codegen, so that coverage spans spend most of their time stored as Span instead. > In addition to being conceptually nicer, this also reduces the size of coverage mappings in MIR, because Span is smaller than 4x u32. That PR was reverted by rust-lang#133608, because in some circumstances not covered by our test suite we were emitting coverage metadata that was causing `llvm-cov` to exit with an error (rust-lang#133606). --- The implementation here is *mostly* the same, but adapted for subsequent changes in the relevant code (e.g. rust-lang#134163). I believe that the changes in rust-lang#134163 should be sufficient to prevent the problem that required the original PR to be reverted. But I haven't been able to reproduce the original breakage in a regression test, and the `llvm-cov` error message is extremely unhelpful, so I can't completely rule out the possibility of this breaking again. r? jieyouxu (reviewer of the original PR)
The original SourceRegion was moved to the llvm backend and made private by rust-lang/rust#134497. We implement our own local version of it to maintain our handling of SourceRegion for coverage properties.
The original SourceRegion was moved to the llvm backend and made private by rust-lang/rust#134497. We implement our own local version of it to maintain our handling of SourceRegion for coverage properties.
The original SourceRegion was moved to the llvm backend and made private by rust-lang/rust#134497. We implement our own local version of it to maintain our handling of SourceRegion for coverage properties.
This is an attempt to re-land #133418:
That PR was reverted by #133608, because in some circumstances not covered by our test suite we were emitting coverage metadata that was causing
llvm-cov
to exit with an error (#133606).The implementation here is mostly the same, but adapted for subsequent changes in the relevant code (e.g. #134163).
I believe that the changes in #134163 should be sufficient to prevent the problem that required the original PR to be reverted. But I haven't been able to reproduce the original breakage in a regression test, and the
llvm-cov
error message is extremely unhelpful, so I can't completely rule out the possibility of this breaking again.r? jieyouxu (reviewer of the original PR)