[PATCH] D101780: [CoverageMapping] Handle gaps in counter IDs for source-based coverage

Pirama Arumuga Nainar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 15:17:01 PDT 2021


pirama added a comment.

In D101780#2752181 <https://reviews.llvm.org/D101780#2752181>, @richkadel wrote:

>> Do we need counters on edges if we're only interested in line segment coverage?
>
> Edge counters exist so they can be operands in expressions, and since they don't have a code region, they would not be referenced directly by a code region in a report; but the expression might, and that's we we need them.

Edge counters help my understanding of the following example I had posted earlier.  Here, counters `#2-#6` are presumably edge counters.

  Counter in file 0 520:20 -> 520:21, #1
  Counter in file 0 520:24 -> 520:25, (#6 + ((((#5 + #4) + #3) + #2) + (#1 - (#6 + (#5 + (#4 + (#3 + #2)))))))

My question was based o the following strategy: use one counter per region and then attempt to reduce the number of counters using counter expressions.  Does using edge counters result in fewer counters compared to the above strategy?  It's entirely possible I'm missing some knowledge about Rust semantics that requires edge counters.

The above example, even if we account for your Rust FE fix to remove the reserved counter `#0` breaks the assumption that `No. of code regions >= No. of counters`.

As an aside, the counter expression above would reduce to `#1` but don't think LLVM or the FE can simplify this.

> (I don't think "line coverage" is a factor. The coverage map only concerns itself with the regions. If the region happens to have one or more newlines, or if there are multiple regions on a line, that isn't relevant to the coverage map; at least not for Rust. `llvm-cov` computes line coverages when generating the report.)

I should have used "region coverage" instead of "line segment coverage" in my original question.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D101780/new/

https://reviews.llvm.org/D101780



More information about the llvm-commits mailing list