[all-commits] [llvm/llvm-project] e4274c: [CoverageMapping] Handle gaps in counter IDs for s...
pirama-arumuga-nainar via All-commits
all-commits at lists.llvm.org
Wed May 19 10:47:06 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: e4274cfe06fe48ed8f0c9f965c8b519e30433bf8
https://github.com/llvm/llvm-project/commit/e4274cfe06fe48ed8f0c9f965c8b519e30433bf8
Author: Pirama Arumuga Nainar <pirama at google.com>
Date: 2021-05-19 (Wed, 19 May 2021)
Changed paths:
M llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h
M llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
M llvm/unittests/ProfileData/CoverageMappingTest.cpp
Log Message:
-----------
[CoverageMapping] Handle gaps in counter IDs for source-based coverage
For source-based coverage, the frontend sets the counter IDs and the
constraints of counter IDs is not defined. For e.g., the Rust frontend
until recently had a reserved counter #0
(https://github.com/rust-lang/rust/pull/83774). Rust coverage
instrumentation also creates counters on edges in addition to basic
blocks. Some functions may have more counters than regions.
This breaks an assumption in CoverageMapping.cpp where the number of
counters in a function is assumed to be bounded by the number of
regions:
Counts.assign(Record.MappingRegions.size(), 0);
This assumption causes CounterMappingContext::evaluate() to fail since
there are not enough counter values created in the above call to
`Counts.assign`. Consequently, some uncovered functions are not
reported in coverage reports.
This change walks a Function's CoverageMappingRecord to find the maximum
counter ID, and uses it to initialize the counter array when instrprof
records are missing for a function in sparse profiles.
Differential Revision: https://reviews.llvm.org/D101780
More information about the All-commits
mailing list