This is an archive of the discontinued LLVM Phabricator instance.

[InstrProf] Single byte counters in coverage
Needs ReviewPublic

Authored by gulfem on Aug 14 2023, 6:36 PM.
This revision needs review, but there are no reviewers specified.

Details

Reviewers
None
Summary

This patch inserts 1-byte counters instead of an 8-byte counters
into llvm profiles for source-based code coverage. The origial idea
was proposed as "block-cov" for PGO, and this patch repurposes that
idea for coverage: https://groups.google.com/g/llvm-dev/c/r03Z6JoN7d4

The current 8-byte counters mechanism add counters to minimal regions,
and infer the counters in the remaining regions via adding or
subtracting counters. For example, it infers the counter in the if.else
region by subtracting the counters between if.entry and if.then regions
in an if statement. Whenever there is a control-flow merge, it adds
the counters from all the incoming regions. However, we are not going to be
able to infer counters by subtracting two execution counts when using
single-byte counters. Therefore, this patch conservatively inserts additional
counters for the cases where we need to add or subtract counters.

Diff Detail

Event Timeline

gulfem created this revision.Aug 14 2023, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 6:36 PM
Herald added subscribers: wlei, ellis, wenlei. · View Herald Transcript
gulfem requested review of this revision.Aug 14 2023, 6:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 14 2023, 6:36 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript