aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-12-07 00:01:15 +0000
committerVedant Kumar <vsk@apple.com>2017-12-07 00:01:15 +0000
commit337b0db1003578810d0d0cf345293b65e74886b7 (patch)
tree5cea9cbfe4d107e48a914bb8e61745e6e4b93811 /llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
parent96d22e12a2ef934283286e2ed1e19a0420476be4 (diff)
downloadllvm-337b0db1003578810d0d0cf345293b65e74886b7.zip
llvm-337b0db1003578810d0d0cf345293b65e74886b7.tar.gz
llvm-337b0db1003578810d0d0cf345293b65e74886b7.tar.bz2
[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/ProfileData/Coverage/CoverageMapping.cpp')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 0d52e48..ccc8cc5 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);
}