-
Notifications
You must be signed in to change notification settings - Fork 13.6k
coverage: Infer instances_used
from pgo_func_name_var_map
#144530
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
In obscure circumstances, we would sometimes emit a covfun record for a function with no physical coverage counters, causing `llvm-cov` to fail with the cryptic error message: malformed instrumentation profile data: function name is empty We can eliminate this mismatch by removing `instances_used` entirely, and instead inferring its contents from the keys of `pgo_func_name_var_map`. This makes it impossible for a "used" function to lack a PGO name entry.
r? @SparrowLii rustbot has assigned @SparrowLii. Use |
r? lqd This change looks good to me. It'd be better to have a test but we don't necessarily need it in this PR, as getting an MCVE from #141577 is not easy. Reducing the issue seems doable to me, but the current repro involving fuzzing is still quite involved, and it seems it'd be painful to produce a minimization in this current state. We should have such a test before relanding #144298 though, so the issue doesn't reappear a 3rd time. With that, @bors r+ |
Rollup of 7 pull requests Successful merges: - #144072 (update `Atomic*::from_ptr` and `Atomic*::as_ptr` docs) - #144151 (`tests/ui/issues/`: The Issues Strike Back [1/N]) - #144300 (Clippy fixes for miropt-test-tools) - #144399 (Add a ratchet for moving all standard library tests to separate packages) - #144472 (str: Mark unstable `round_char_boundary` feature functions as const) - #144503 (Various refactors to the codegen coordinator code (part 3)) - #144530 (coverage: Infer `instances_used` from `pgo_func_name_var_map`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of #144530 - Zalathar:instances-used, r=lqd coverage: Infer `instances_used` from `pgo_func_name_var_map` In obscure circumstances involving macro-expanded spans, we would sometimes emit a covfun record for a function with no physical coverage counters, and therefore no corresponding entry in the “PGO names” section of the binary. The absence of that name entry causes `llvm-cov` to fail with the cryptic error message: ```text malformed instrumentation profile data: function name is empty ``` We can eliminate this mismatch by removing `instances_used` entirely, and instead inferring its contents from the keys of `pgo_func_name_var_map`. This makes it impossible for a "used" function to lack a PGO name entry. --- This is an attempt to eliminate the cause of #141577 when re-landing changes like #144298 in the future. I haven't been able to reproduce the underlying issue in an in-tree test, because the only known repro involves a non-trivial derive proc-macro that relies on `syn` and `proc-macro2`. But I have manually verified in a separate branch that this change would have prevented the reoccurrence of #141577 (comment).
In obscure circumstances involving macro-expanded spans, we would sometimes emit a covfun record for a function with no physical coverage counters, and therefore no corresponding entry in the “PGO names” section of the binary. The absence of that name entry causes
llvm-cov
to fail with the cryptic error message:We can eliminate this mismatch by removing
instances_used
entirely, and instead inferring its contents from the keys ofpgo_func_name_var_map
.This makes it impossible for a "used" function to lack a PGO name entry.
This is an attempt to eliminate the cause of #141577 when re-landing changes like #144298 in the future.
I haven't been able to reproduce the underlying issue in an in-tree test, because the only known repro involves a non-trivial derive proc-macro that relies on
syn
andproc-macro2
. But I have manually verified in a separate branch that this change would have prevented the reoccurrence of #141577 (comment).