diff options
| author | Vedant Kumar <vsk@apple.com> | 2017-12-07 00:01:15 +0000 |
|---|---|---|
| committer | Vedant Kumar <vsk@apple.com> | 2017-12-07 00:01:15 +0000 |
| commit | 337b0db1003578810d0d0cf345293b65e74886b7 (patch) | |
| tree | 5cea9cbfe4d107e48a914bb8e61745e6e4b93811 /llvm/lib | |
| parent | 96d22e12a2ef934283286e2ed1e19a0420476be4 (diff) | |
| download | bcm5719-llvm-337b0db1003578810d0d0cf345293b65e74886b7.tar.gz bcm5719-llvm-337b0db1003578810d0d0cf345293b65e74886b7.zip | |
[Coverage] Scan ahead for the most-recent completed count (PR35495)
This extends r319391. It teaches the segment builder to emit the right
completed segment when more than one region ends at the same location.
Fixes PR35495.
llvm-svn: 319990
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/ProfileData/Coverage/CoverageMapping.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp index 0d52e48084f..ccc8cc56eb0 100644 --- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp +++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp @@ -388,11 +388,10 @@ class SegmentBuilder { if (CompletedSegmentLoc == CompletedRegion->endLoc()) continue; - // Use the count from the next completed region if it ends at the same - // location. - if (I + 1 < E && - CompletedRegion->endLoc() == ActiveRegions[I + 1]->endLoc()) - CompletedRegion = ActiveRegions[I + 1]; + // Use the count from the last completed region which ends at this loc. + for (unsigned J = I + 1; J < E; ++J) + if (CompletedRegion->endLoc() == ActiveRegions[J]->endLoc()) + CompletedRegion = ActiveRegions[J]; startSegment(*CompletedRegion, CompletedSegmentLoc, false); } |

