coverage: Infer instances_used
from pgo_func_name_var_map
#144530
+28
−22
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.
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).