summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Stellard <tstellar@redhat.com>2021-02-22 17:35:09 -0800
committerTom Stellard <tstellar@redhat.com>2021-02-22 17:35:09 -0800
commita92ceea91116e7b95d23eff634507fa2cff86ef2 (patch)
tree5761e894caf6456f9861c415fce81ee978445f4e
parentda7fa7457800394d610e8cbd6befe7bc944ca7d0 (diff)
downloadllvm-a92ceea91116e7b95d23eff634507fa2cff86ef2.tar.gz
Revert "[llvm-cov] reset executation count to 0 after wrapped segment"
This reverts commit e3df9471750935876bd2bf7da93ccf0eacca8592. This commit caused regressions in coverage generation for both Rust and Swift. We're reverting this in the release/12.x branch until we have a proper fix in trunk. http://llvm.org/PR49297
-rw-r--r--llvm/lib/ProfileData/Coverage/CoverageMapping.cpp1
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h2
-rw-r--r--llvm/test/tools/llvm-cov/ignore-filename-regex.test4
-rw-r--r--llvm/unittests/ProfileData/CoverageMappingTest.cpp2
4 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
index a8cc308b4e3a..cdbcde50d33a 100644
--- a/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
+++ b/llvm/lib/ProfileData/Coverage/CoverageMapping.cpp
@@ -794,7 +794,6 @@ LineCoverageStats::LineCoverageStats(
ExecutionCount = WrappedSegment->Count;
if (!MinRegionCount)
return;
- ExecutionCount = 0;
for (const auto *LS : LineSegments)
if (isStartOfRegion(LS))
ExecutionCount = std::max(ExecutionCount, LS->Count);
diff --git a/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h b/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
index d224fd0d00ea..07941f9bb497 100644
--- a/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
+++ b/llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h
@@ -12,7 +12,7 @@ template <class T> T FOO<T>::DoIt(T ti) { // HEADER: [[@LINE]]| 2|template
for (T I = 0; I < ti; I++) { // HEADER: [[@LINE]]| 22| for (T
t += I; // HEADER: [[@LINE]]| 20| t += I;
if (I > ti / 2) // HEADER: [[@LINE]]| 20| if (I > ti
- t -= 1; // HEADER: [[@LINE]]| 8| t -= 1;
+ t -= 1; // HEADER: [[@LINE]]| 20| t -= 1;
} // HEADER: [[@LINE]]| 20| }
// HEADER: [[@LINE]]| 2|
return t; // HEADER: [[@LINE]]| 2| return t;
diff --git a/llvm/test/tools/llvm-cov/ignore-filename-regex.test b/llvm/test/tools/llvm-cov/ignore-filename-regex.test
index efc4cda4abc0..aea9e4646776 100644
--- a/llvm/test/tools/llvm-cov/ignore-filename-regex.test
+++ b/llvm/test/tools/llvm-cov/ignore-filename-regex.test
@@ -22,7 +22,7 @@ REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
-REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}90.00%{{$}}
+REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}100.00%{{$}}
# Ignore all files from "extra" directory even when SOURCES specified.
RUN: llvm-cov report -instr-profile %S/Inputs/sources_specified/main.profdata \
@@ -35,7 +35,7 @@ REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
-REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}80.00%{{$}}
+REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}100.00%{{$}}
########################
# Test "show" command.
diff --git a/llvm/unittests/ProfileData/CoverageMappingTest.cpp b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
index 43386d23883e..4854b7f1454c 100644
--- a/llvm/unittests/ProfileData/CoverageMappingTest.cpp
+++ b/llvm/unittests/ProfileData/CoverageMappingTest.cpp
@@ -675,7 +675,7 @@ TEST_P(CoverageMappingTest, test_line_coverage_iterator) {
CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
unsigned Line = 0;
- unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0};
+ unsigned LineCounts[] = {20, 20, 20, 20, 30, 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";