[PATCH] D85036: [llvm-cov] reset executation count to 0 after wrapped segment

Zequan Wu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 15:00:58 PDT 2020


zequanwu updated this revision to Diff 282324.
zequanwu added a comment.

Update coverage unit test.
line 5 to line 9 should have executation count of 10.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85036/new/

https://reviews.llvm.org/D85036

Files:
  llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
  llvm/unittests/ProfileData/CoverageMappingTest.cpp


Index: llvm/unittests/ProfileData/CoverageMappingTest.cpp
===================================================================
--- llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -675,7 +675,7 @@
   CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
 
   unsigned Line = 0;
-  unsigned LineCounts[] = {20, 20, 20, 20, 30, 10, 10, 10, 10, 0, 0};
+  unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0};
   for (const auto &LCS : getLineCoverageStats(Data)) {
     ASSERT_EQ(Line + 1, LCS.getLine());
     errs() << "Line: " << Line + 1 << ", count = " << LCS.getExecutionCount() << "\n";
Index: llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
===================================================================
--- llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -770,6 +770,7 @@
     ExecutionCount = WrappedSegment->Count;
   if (!MinRegionCount)
     return;
+  ExecutionCount = 0;
   for (const auto *LS : LineSegments)
     if (isStartOfRegion(LS))
       ExecutionCount = std::max(ExecutionCount, LS->Count);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D85036.282324.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200731/2df199a0/attachment.bin>


More information about the llvm-commits mailing list