Skip to content

Commit 686d4f6

Browse files
committed
Revert "[llvm-cov] reset executation count to 0 after wrapped segment"
This reverts commit e3df947.
1 parent cb28f0f commit 686d4f6

File tree

4 files changed

+4
-5
lines changed

4 files changed

+4
-5
lines changed

llvm/lib/ProfileData/Coverage/CoverageMapping.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,6 @@ LineCoverageStats::LineCoverageStats(
794794
ExecutionCount = WrappedSegment->Count;
795795
if (!MinRegionCount)
796796
return;
797-
ExecutionCount = 0;
798797
for (const auto *LS : LineSegments)
799798
if (isStartOfRegion(LS))
800799
ExecutionCount = std::max(ExecutionCount, LS->Count);

llvm/test/tools/llvm-cov/Inputs/instrprof-comdat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ template <class T> T FOO<T>::DoIt(T ti) { // HEADER: [[@LINE]]| 2|template
1212
for (T I = 0; I < ti; I++) { // HEADER: [[@LINE]]| 22| for (T
1313
t += I; // HEADER: [[@LINE]]| 20| t += I;
1414
if (I > ti / 2) // HEADER: [[@LINE]]| 20| if (I > ti
15-
t -= 1; // HEADER: [[@LINE]]| 8| t -= 1;
15+
t -= 1; // HEADER: [[@LINE]]| 20| t -= 1;
1616
} // HEADER: [[@LINE]]| 20| }
1717
// HEADER: [[@LINE]]| 2|
1818
return t; // HEADER: [[@LINE]]| 2| return t;

llvm/test/tools/llvm-cov/ignore-filename-regex.test

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}dec.h{{.*}}
2222
REPORT_IGNORE_DIR-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
2323
REPORT_IGNORE_DIR: {{.*}}abs.h{{.*}}
2424
REPORT_IGNORE_DIR: {{.*}}main.cc{{.*}}
25-
REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}90.00%{{$}}
25+
REPORT_IGNORE_DIR: {{^}}TOTAL 5{{.*}}100.00%{{$}}
2626

2727
# Ignore all files from "extra" directory even when SOURCES specified.
2828
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{{.*}}
3535
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}extra{{[/\\]}}inc.h{{.*}}
3636
REPORT_IGNORE_DIR_WITH_SOURCES-NOT: {{.*}}main.cc{{.*}}
3737
REPORT_IGNORE_DIR_WITH_SOURCES: {{.*}}abs.h{{.*}}
38-
REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}80.00%{{$}}
38+
REPORT_IGNORE_DIR_WITH_SOURCES: {{^}}TOTAL 4{{.*}}100.00%{{$}}
3939

4040
########################
4141
# Test "show" command.

llvm/unittests/ProfileData/CoverageMappingTest.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ TEST_P(CoverageMappingTest, test_line_coverage_iterator) {
675675
CoverageData Data = LoadedCoverage->getCoverageForFile("file1");
676676

677677
unsigned Line = 0;
678-
unsigned LineCounts[] = {20, 20, 20, 20, 10, 10, 10, 10, 10, 0, 0};
678+
unsigned LineCounts[] = {20, 20, 20, 20, 30, 10, 10, 10, 10, 0, 0};
679679
for (const auto &LCS : getLineCoverageStats(Data)) {
680680
ASSERT_EQ(Line + 1, LCS.getLine());
681681
errs() << "Line: " << Line + 1 << ", count = " << LCS.getExecutionCount() << "\n";

0 commit comments

Comments
 (0)