-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
[LLVM-COV] Fix branch coverage merging across function instantiations #49738
Comments
Hi Todd, What is your opinion on backporting this? https://reviews.llvm.org/rGeccb925147d5f262a3e74cc050d0665dd4e6d8db |
Merged: b89942c |
Ignore this, the automation was confused by the revert. |
I'm OK with backporting this to the 12.x release branch |
What is the final version of the fix that needs to be backported? |
Hi Tom, The final version of the fix is what I originally reported and tried to merge to the branch before. There haven't been any changes since then. Let me know if that's not what you are referring to. https://reviews.llvm.org/rGeccb925147d5f262a3e74cc050d0665dd4e6d8db |
Merged: b89942c |
Hi Tom -- I don't yet see this merge on the 12.x branch. The commit SHA looks to be the original commit we did that was later reverted. Not sure if something got mixed up here. Thanks! |
Do I just need to unrevert b89942c to fix this bug? |
Yes, unreverting it should do the trick. Thanks! |
Extended Description
When I made the upstream commit for branch coverage support in code-coverage in January, I made an incorrect assumption that branch coverage numbers (covered branch and total branches) should be accumulated across function instantiations. This is not what is done for lines and regions, where the maximum line/region coverage found in a function instantiation across an instantiation group is returned. For example, if a function template definition has 2 total branches, the branch coverage would be reported as an accumulated total across all instantiations (8 total branches across 4 instantiations).
The correct assumption for the FunctionCoverageSummary::get(const InstantiationGroup &Group, ...) routine is that the summary it returns should agree with the function definition in the source code on lines, regions, and branches. So we should do the same thing for branch coverage as we do for line and region coverage. If a function template definition has 2 total branches, the summary should also reflect branch coverage for 2 total branches.
Code Review for fix:
https://reviews.llvm.org/D102193
Main branch commit for fix:
https://reviews.llvm.org/rGeccb925147d5f262a3e74cc050d0665dd4e6d8db
This fix needs to be applied to the 12.x release branch.
The text was updated successfully, but these errors were encountered: