<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/119299>119299</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
llvm-cov: Insufficient merging strategy for template instantiations
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
chapuni
</td>
</tr>
</table>
<pre>
# `llvm-cov report`
`llvm-cov report` merges metrics for instantiations with the strategy "Take max(covered)/max(num) for each instantance".
* Line (and region): Each instance may have different number of records, due to skipped regions by instantiation-time constants. This sometimes confuses the strategy `max/max`.
* Branch and MC/DC: Due to folded conditions, the result might show false negative with the strategy "max/max".
# `llvm-cov show` Source view
The merged counters can be seen in Line (and region) counters. They show max counters in each record. I think this will be less informative if any instances are not fully covered on their own.
Branches and MC/DC records are not merged in the source view. It is noisy. Actual uncovered branches should be found in instantiation subviews.
Anyways, the source view doesn't reflect the summary. (see also #119282)
# Possible merge strategies
Planning. It should be better if merged result can be seen in the source view. `llvm-cov` will accept one of strategies below by command line options.
They below are listed in order of tolerance.
## Count up after merging records
* Line (and region): Skipped lines will be filled.
* Branch: Folded conditions will be dissolved.
* MC/DC: Discovers more independence pairs by merging test vectors. (This will require moving `findIndependencePairs` deferred)
I think:
* For the coverage of the complex codebase (e.g. LLVM), merging records will be more practical.
* For local scope non-template functions (static inline functions in header files), merging records should be the best.
## Max(any)
This assumes harderning the current strategy. Show "covered" if one of instantiations is fully covered.
This might be confused in skipped/folded stuff.
## Min(all)
This actually means, "Don't merge, just count up each instance". The template will be "not covered at all" if at least one instantiation is not executed.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyEVttu2zgTfhr6ZhDBoR0fLnyRJr-BAC1QoMF_T1FDiy1FajmkXb_9YihZPmwXCwQJYlHD-Q7zjRWRPXjEnXj5Il7eZyqnNsSdblWfvZ3VoTnvhFyAWM2dO3ZPOhw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