summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCalixte Denizet <cdenizet@mozilla.com>2018-09-20 16:09:30 +0000
committerCalixte Denizet <cdenizet@mozilla.com>2018-09-20 16:09:30 +0000
commit0b1fe47e22e69f9507ee57aece722969f2e7e695 (patch)
treea2bf10f618f86039e1378d5766535d9221de6113 /llvm/test
parentcfa1d499f92d52c2ac2443c52fb77ad2fc64591d (diff)
downloadbcm5719-llvm-0b1fe47e22e69f9507ee57aece722969f2e7e695.tar.gz
bcm5719-llvm-0b1fe47e22e69f9507ee57aece722969f2e7e695.zip
[gcov] Fix wrong line hit counts when multiple blocks are on the same line
Summary: The goal of this patch is to have the same behaviour than gcc-gcov. Currently the hit counts for a line is the sum of the counts for each block on that line. The idea is to detect the cycles in the graph of blocks in using the algorithm by Hawick & James. The count for a cycle is the min of the counts for each edge in the cycle. Once we've the count for each cycle, we can sum them and add the transition counts of those cycles. Fix both https://bugs.llvm.org/show_bug.cgi?id=38065 and https://bugs.llvm.org/show_bug.cgi?id=38066 Reviewers: marco-c, davidxl Reviewed By: marco-c Subscribers: vsk, lebedev.ri, sylvestre.ledru, dblaikie, llvm-commits Differential Revision: https://reviews.llvm.org/D49659 llvm-svn: 342657
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov2
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov8
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov8
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov8
-rw-r--r--llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov8
-rw-r--r--llvm/test/tools/llvm-cov/range_based_for.cpp2
13 files changed, 25 insertions, 25 deletions
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
index c2210d5eca1..78ebbfc1a91 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a.cpp.gcov
@@ -49,7 +49,7 @@
4: 34-block 0
12: 34-block 1
8: 34-block 2
- 8: 35: assign(ii, jj);
+ 12: 35: assign(ii, jj);
8: 35-block 0
4: 35-block 1
2: 36:}
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov
index a5fe62b1cec..84fcb529d45 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a.h.gcov
@@ -3,7 +3,7 @@
-: 0:Data:test.gcda
-: 0:Runs:2
-: 0:Programs:1
- 2: 1:struct A {
+ 4: 1:struct A {
2: 1-block 0
2: 1-block 1
-: 2: virtual void B();
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
index ae21037401f..b1e658e6d2b 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.cpp.gcov
@@ -60,7 +60,7 @@ branch 1 taken 33%
branch 0 taken 67%
branch 1 taken 33%
8: 34-block 2
- 8: 35: assign(ii, jj);
+ 12: 35: assign(ii, jj);
8: 35-block 0
4: 35-block 1
2: 36:}
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
index f3dabcb727c..d85b56239d1 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b.h.gcov
@@ -5,7 +5,7 @@
-: 0:Programs:1
function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
- 2: 1:struct A {
+ 4: 1:struct A {
2: 1-block 0
2: 1-block 1
-: 2: virtual void B();
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
index cc5940f8b92..603d14e483b 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.cpp.gcov
@@ -70,7 +70,7 @@ branch 1 taken 8
branch 2 taken 4
8: 34-block 2
unconditional 3 taken 8
- 8: 35: assign(ii, jj);
+ 12: 35: assign(ii, jj);
8: 35-block 0
unconditional 0 taken 8
4: 35-block 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
index 840324e9f9f..e980e2101b2 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-c_-u.h.gcov
@@ -5,7 +5,7 @@
-: 0:Programs:1
function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
- 2: 1:struct A {
+ 4: 1:struct A {
2: 1-block 0
unconditional 0 taken 2
2: 1-block 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
index 0d2c6b39356..f9f5f307a46 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.cpp.gcov
@@ -70,7 +70,7 @@ branch 1 taken 67%
branch 2 taken 33%
8: 34-block 2
unconditional 3 taken 100%
- 8: 35: assign(ii, jj);
+ 12: 35: assign(ii, jj);
8: 35-block 0
unconditional 0 taken 100%
4: 35-block 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
index e7fa658b290..923ac8ab64b 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_-a_-b_-u.h.gcov
@@ -5,7 +5,7 @@
-: 0:Programs:1
function _ZN1AC1Ev called 2 returned 100% blocks executed 100%
function _ZN1AC2Ev called 2 returned 100% blocks executed 100%
- 2: 1:struct A {
+ 4: 1:struct A {
2: 1-block 0
unconditional 0 taken 100%
2: 1-block 1
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov
index 1c138e42581..9b3da2735a5 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_missing.cpp.gcov
@@ -35,8 +35,8 @@
12: 30:/*EOF*/
-: 31:/*EOF*/
-: 32:/*EOF*/
- 21: 33:/*EOF*/
- 36: 34:/*EOF*/
+ 9: 33:/*EOF*/
+ 18: 34:/*EOF*/
18: 35:/*EOF*/
3: 36:/*EOF*/
-: 37:/*EOF*/
@@ -53,7 +53,7 @@
#####: 48:/*EOF*/
-: 49:/*EOF*/
-: 50:/*EOF*/
- 66: 51:/*EOF*/
+ 33: 51:/*EOF*/
30: 52:/*EOF*/
-: 53:/*EOF*/
6: 54:/*EOF*/
@@ -71,7 +71,7 @@
30: 66:/*EOF*/
-: 67:/*EOF*/
3: 68:/*EOF*/
-25769803782: 69:/*EOF*/
+12884901891: 69:/*EOF*/
12884901888: 70:/*EOF*/
-: 71:/*EOF*/
3: 72:/*EOF*/
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
index 871e3ba6445..8524c9a5213 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_no_options.cpp.gcov
@@ -35,8 +35,8 @@
8: 30:}
-: 31:
-: 32:void initialize_grid() {
- 12: 33: for (int ii = 0; ii < 2; ii++)
- 24: 34: for (int jj = 0; jj < 2; jj++)
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 12: 34: for (int jj = 0; jj < 2; jj++)
12: 35: assign(ii, jj);
2: 36:}
-: 37:
@@ -53,7 +53,7 @@
#####: 48: a += rand();
-: 49: }
-: 50:
- 44: 51: for (int ii = 0; ii < 10; ++ii) {
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
20: 52: switch (rand() % 5) {
-: 53: case 0:
4: 54: a += rand();
@@ -71,7 +71,7 @@
20: 66: }
-: 67:
2: 68: A thing;
-17179869188: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
8589934592: 70: thing.B();
-: 71:
2: 72: return a + 8 + grid[2][3] + len;
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
index abf88567801..22c8a2ad950 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_objdir.cpp.gcov
@@ -35,8 +35,8 @@
8: 30:}
-: 31:
-: 32:void initialize_grid() {
- 12: 33: for (int ii = 0; ii < 2; ii++)
- 24: 34: for (int jj = 0; jj < 2; jj++)
+ 6: 33: for (int ii = 0; ii < 2; ii++)
+ 12: 34: for (int jj = 0; jj < 2; jj++)
12: 35: assign(ii, jj);
2: 36:}
-: 37:
@@ -53,7 +53,7 @@
#####: 48: a += rand();
-: 49: }
-: 50:
- 44: 51: for (int ii = 0; ii < 10; ++ii) {
+ 22: 51: for (int ii = 0; ii < 10; ++ii) {
20: 52: switch (rand() % 5) {
-: 53: case 0:
4: 54: a += rand();
@@ -71,7 +71,7 @@
20: 66: }
-: 67:
2: 68: A thing;
-17179869188: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+8589934594: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
8589934592: 70: thing.B();
-: 71:
2: 72: return a + 8 + grid[2][3] + len;
diff --git a/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov b/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
index 3982ddf4e5f..9b89f51246c 100644
--- a/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
+++ b/llvm/test/tools/llvm-cov/Inputs/test_paths.cpp.gcov
@@ -35,8 +35,8 @@
12: 30:}
-: 31:
-: 32:void initialize_grid() {
- 21: 33: for (int ii = 0; ii < 2; ii++)
- 36: 34: for (int jj = 0; jj < 2; jj++)
+ 9: 33: for (int ii = 0; ii < 2; ii++)
+ 18: 34: for (int jj = 0; jj < 2; jj++)
18: 35: assign(ii, jj);
3: 36:}
-: 37:
@@ -53,7 +53,7 @@
#####: 48: a += rand();
-: 49: }
-: 50:
- 66: 51: for (int ii = 0; ii < 10; ++ii) {
+ 33: 51: for (int ii = 0; ii < 10; ++ii) {
30: 52: switch (rand() % 5) {
-: 53: case 0:
6: 54: a += rand();
@@ -71,7 +71,7 @@
30: 66: }
-: 67:
3: 68: A thing;
-25769803782: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
+12884901891: 69: for (uint64_t ii = 0; ii < 4294967296; ++ii)
12884901888: 70: thing.B();
-: 71:
3: 72: return a + 8 + grid[2][3] + len;
diff --git a/llvm/test/tools/llvm-cov/range_based_for.cpp b/llvm/test/tools/llvm-cov/range_based_for.cpp
index 2934650627e..3331dff55df 100644
--- a/llvm/test/tools/llvm-cov/range_based_for.cpp
+++ b/llvm/test/tools/llvm-cov/range_based_for.cpp
@@ -20,7 +20,7 @@
int main(int argc, const char *argv[]) { // GCOV: 1: [[@LINE]]:int main(
int V[] = {1, 2}; // GCOV: 1: [[@LINE]]: int V[]
- for (int &I : V) { // GCOV: 10: [[@LINE]]: for (
+ for (int &I : V) { // GCOV: 5: [[@LINE]]: for (
} // GCOV: 2: [[@LINE]]: }
return 0; // GCOV: 1: [[@LINE]]: return
} // GCOV: -: [[@LINE]]:}
OpenPOWER on IntegriCloud