summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-11-30 00:28:23 +0000
committerVedant Kumar <vsk@apple.com>2017-11-30 00:28:23 +0000
commit80fbb85555b51fbb8c500ec13756490400191865 (patch)
tree130551fa07fa381c0b9bf9f87c973f1068c2d4cd /llvm/lib
parent9e3175bb6b2c9d3d9bbb46f64c6a4e416d794e57 (diff)
downloadbcm5719-llvm-80fbb85555b51fbb8c500ec13756490400191865.tar.gz
bcm5719-llvm-80fbb85555b51fbb8c500ec13756490400191865.zip
[Coverage] Use the most-recent completed region count (PR35437)
This is a fix for the coverage segment builder. If multiple regions must be popped off the active stack at once, and more than one of them end at the same location, emit a segment using the count from the most-recent completed region. Fixes PR35437, rdar://35760630 Testing: invoked llvm-cov on a stage2 build of clang, additional unit tests, check-profile llvm-svn: 319391
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index 6cde3863f18..0d52e48084f 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -388,6 +388,12 @@ 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];
+
startSegment(*CompletedRegion, CompletedSegmentLoc, false);
}
OpenPOWER on IntegriCloud