[llvm] [Coverage] Improve performance of propagating Counter of Expansions (PR #122589)
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 22:30:25 PST 2025
================
@@ -440,26 +441,83 @@ Error RawCoverageMappingReader::read() {
// Set the counters for the expansion regions.
// i.e. Counter of expansion region = counter of the first region
// from the expanded file.
- // Perform multiple passes to correctly propagate the counters through
- // all the nested expansion regions.
- SmallVector<CounterMappingRegion *, 8> FileIDExpansionRegionMapping;
- FileIDExpansionRegionMapping.resize(VirtualFileMapping.size(), nullptr);
- for (unsigned Pass = 1, S = VirtualFileMapping.size(); Pass < S; ++Pass) {
- for (auto &R : MappingRegions) {
- if (R.Kind != CounterMappingRegion::ExpansionRegion)
- continue;
- assert(!FileIDExpansionRegionMapping[R.ExpandedFileID]);
- FileIDExpansionRegionMapping[R.ExpandedFileID] = &R;
+ // This assumes:
+ // - Records are partitioned by FileID.
+ // - The Count in Expansion is propagated from 1st Record in
----------------
ornata wrote:
e.g.
nth record's count == n-1th count + n-2th count ... 0th count?
https://github.com/llvm/llvm-project/pull/122589
More information about the llvm-commits
mailing list