[llvm] llvm-cov: Introduce `--binary-counters` (PR #120841)

NAKAMURA Takumi via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 27 02:46:43 PST 2024


https://github.com/chapuni updated https://github.com/llvm/llvm-project/pull/120841

>From 805e9a93093121a3cde6c569b0247be6f68601fb Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Sat, 21 Dec 2024 17:32:28 +0900
Subject: [PATCH 1/6] llvm-cov: Introduce `--binary-counters`

---
 .../tools/llvm-cov/Inputs/branch-macros.cpp   | 52 +++++++++++++
 .../Inputs/showLineExecutionCounts.cpp        | 30 ++++++++
 llvm/test/tools/llvm-cov/branch-macros.cpp    | 60 ---------------
 llvm/test/tools/llvm-cov/branch-macros.test   | 12 +++
 .../llvm-cov/showLineExecutionCounts.cpp      | 73 -------------------
 .../llvm-cov/showLineExecutionCounts.test     | 46 ++++++++++++
 llvm/tools/llvm-cov/CodeCoverage.cpp          |  6 ++
 llvm/tools/llvm-cov/CoverageViewOptions.h     |  1 +
 llvm/tools/llvm-cov/SourceCoverageView.h      |  9 ++-
 .../tools/llvm-cov/SourceCoverageViewHTML.cpp | 15 ++--
 .../tools/llvm-cov/SourceCoverageViewText.cpp |  6 +-
 11 files changed, 167 insertions(+), 143 deletions(-)
 create mode 100644 llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
 create mode 100644 llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts.cpp
 delete mode 100644 llvm/test/tools/llvm-cov/branch-macros.cpp
 create mode 100644 llvm/test/tools/llvm-cov/branch-macros.test
 delete mode 100644 llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
 create mode 100644 llvm/test/tools/llvm-cov/showLineExecutionCounts.test

diff --git a/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp b/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
new file mode 100644
index 00000000000000..ad627106f32bd5
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/branch-macros.cpp
@@ -0,0 +1,52 @@
+
+
+
+
+#define COND1 (a == b)
+#define COND2 (a != b)
+#define COND3 (COND1 && COND2)
+#define COND4 (COND3 ? COND2 : COND1) // BRCOV: | Branch ([[@LINE]]:15): [True: 1, False: [[#min(C,2)]]]
+#define MACRO1 COND3
+#define MACRO2 MACRO1
+#define MACRO3 MACRO2
+
+#include <stdlib.h>
+
+// CHECK: |{{ +}}[[#min(C,3)]]|bool func(
+bool func(int a, int b) {
+  bool c = COND1 && COND2; // BRCOV: |  |  |  Branch ([[@LINE-12]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // BRCOV: |  |  |  Branch ([[@LINE-12]]:15): [True: 0, False: 1]
+  bool d = COND3;          // BRCOV: |  |  |  |  |  Branch ([[@LINE-14]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // BRCOV: |  |  |  |  |  Branch ([[@LINE-14]]:15): [True: 0, False: 1]
+  bool e = MACRO1;         // BRCOV: |  |  |  |  |  |  |  Branch ([[@LINE-16]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // BRCOV: |  |  |  |  |  |  |  Branch ([[@LINE-16]]:15): [True: 0, False: 1]
+  bool f = MACRO2;         // BRCOV: |  |  |  |  |  |  |  |  |  Branch ([[@LINE-18]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // BRCOV: |  |  |  |  |  |  |  |  |  Branch ([[@LINE-18]]:15): [True: 0, False: 1]
+  bool g = MACRO3;         // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-20]]:15): [True: 1, False: [[#min(C,2)]]]
+                           // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-20]]:15): [True: 0, False: 1]
+  return c && d && e && f && g;
+                           // BRCOV: |  Branch ([[@LINE-1]]:10): [True: 0, False: [[#min(C,3)]]]
+                           // BRCOV: |  Branch ([[@LINE-2]]:15): [True: 0, False: 0]
+                           // BRCOV: |  Branch ([[@LINE-3]]:20): [True: 0, False: 0]
+                           // BRCOV: |  Branch ([[@LINE-4]]:25): [True: 0, False: 0]
+                           // BRCOV: |  Branch ([[@LINE-5]]:30): [True: 0, False: 0]
+}
+
+
+bool func2(int a, int b) {
+    bool h = MACRO3 || COND4;  // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-32]]:15): [True: 1, False: [[#min(C,2)]]]
+                               // BRCOV: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-32]]:15): [True: 0, False: 1]
+                               // BRCOV: |  |  |  |  |  |  |  Branch ([[@LINE-34]]:15): [True: 1, False: [[#min(C,2)]]]
+                               // BRCOV: |  |  |  |  |  |  |  Branch ([[@LINE-34]]:15): [True: 0, False: 1]
+                               // BRCOV: |  |  |  Branch ([[@LINE-33]]:15): [True: 1, False: [[#min(C,2)]]]
+  return h;
+}
+
+
+int main(int argc, char *argv[])
+{
+  func(atoi(argv[1]), atoi(argv[2]));
+  func2(atoi(argv[1]), atoi(argv[2]));
+  (void)0;
+  return 0;
+}
diff --git a/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts.cpp
new file mode 100644
index 00000000000000..be780b45f279c5
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/Inputs/showLineExecutionCounts.cpp
@@ -0,0 +1,30 @@
+// HTML-WHOLE-FILE: <td class='line-number'><a name='L[[@LINE+2]]' href='#L[[@LINE+2]]'><pre>[[@LINE+2]]</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// before
+// HTML-FILTER-NOT: <td class='line-number'><a name='L[[@LINE+1]]' href='#L[[@LINE+1]]'><pre>[[@LINE+1]]</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// before
+// before any coverage              // WHOLE-FILE: [[@LINE]]|                     |// before
+                                    // FILTER-NOT: [[@LINE-1]]|                   |// before
+// HTML: <td class='line-number'><a name='L[[@LINE+1]]' href='#L[[@LINE+1]]'><pre>[[@LINE+1]]</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>int main() {
+int main() {                              // TEXT: [[@LINE]]| [[#C161:min(C,161)]]|int main(
+  int x = 0;                              // TEXT: [[@LINE]]|            [[#C161]]|  int x
+
+  if (x) {                                // TEXT: [[@LINE]]|            [[#C161]]|  if (x)
+    x = 0;                                // TEXT: [[@LINE]]|                    0|    x = 0
+  } else {                                // TEXT: [[@LINE]]|            [[#C161]]|  } else
+    x = 1;                                // TEXT: [[@LINE]]|            [[#C161]]|    x = 1
+  }                                       // TEXT: [[@LINE]]|            [[#C161]]|  }
+
+  for (int i = 0; i < 100; ++i) {         // TEXT: [[@LINE]]|            [[C16K2]]|  for (
+    x = 1;                                // TEXT: [[@LINE]]|            [[C16K1]]|    x = 1
+  }                                       // TEXT: [[@LINE]]|            [[C16K1]]|  }
+
+  x = x < 10 ? x + 1 : x - 1;             // TEXT: [[@LINE]]|            [[#C161]]|  x =
+  x = x > 10 ?                            // TEXT: [[@LINE]]|            [[#C161]]|  x =
+        x - 1:                            // TEXT: [[@LINE]]|                    0|        x
+        x + 1;                            // TEXT: [[@LINE]]|            [[#C161]]|        x
+
+  return 0;                               // TEXT: [[@LINE]]|            [[#C161]]|  return
+}                                         // TEXT: [[@LINE]]|            [[#C161]]|}
+// after coverage                   // WHOLE-FILE: [[@LINE]]|                     |// after
+                                    // FILTER-NOT: [[@LINE-1]]|                   |// after
+// HTML-BINARY-NOT: <td class='covered-line'><pre>16
+// HTML-WHOLE-FILE: <td class='line-number'><a name='L[[@LINE-3]]' href='#L[[@LINE-3]]'><pre>[[@LINE-3]]</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// after
+// HTML-FILTER-NOT: <td class='line-number'><a name='L[[@LINE-4]]' href='#L[[@LINE-4]]'><pre>[[@LINE-4]]</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// after
diff --git a/llvm/test/tools/llvm-cov/branch-macros.cpp b/llvm/test/tools/llvm-cov/branch-macros.cpp
deleted file mode 100644
index 7f3d1e8bffb82a..00000000000000
--- a/llvm/test/tools/llvm-cov/branch-macros.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// RUN: llvm-profdata merge %S/Inputs/branch-macros.proftext -o %t.profdata
-// RUN: llvm-cov show --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck %s
-// RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S %s | FileCheck %s -check-prefix=REPORT
-
-#define COND1 (a == b)
-#define COND2 (a != b)
-#define COND3 (COND1 && COND2)
-#define COND4 (COND3 ? COND2 : COND1) // CHECK: | Branch ([[@LINE]]:15): [True: 1, False: 2]
-#define MACRO1 COND3
-#define MACRO2 MACRO1
-#define MACRO3 MACRO2
-
-#include <stdlib.h>
-
-
-bool func(int a, int b) {
-  bool c = COND1 && COND2; // CHECK: |  |  |  Branch ([[@LINE-12]]:15): [True: 1, False: 2]
-                           // CHECK: |  |  |  Branch ([[@LINE-12]]:15): [True: 0, False: 1]
-  bool d = COND3;          // CHECK: |  |  |  |  |  Branch ([[@LINE-14]]:15): [True: 1, False: 2]
-                           // CHECK: |  |  |  |  |  Branch ([[@LINE-14]]:15): [True: 0, False: 1]
-  bool e = MACRO1;         // CHECK: |  |  |  |  |  |  |  Branch ([[@LINE-16]]:15): [True: 1, False: 2]
-                           // CHECK: |  |  |  |  |  |  |  Branch ([[@LINE-16]]:15): [True: 0, False: 1]
-  bool f = MACRO2;         // CHECK: |  |  |  |  |  |  |  |  |  Branch ([[@LINE-18]]:15): [True: 1, False: 2]
-                           // CHECK: |  |  |  |  |  |  |  |  |  Branch ([[@LINE-18]]:15): [True: 0, False: 1]
-  bool g = MACRO3;         // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-20]]:15): [True: 1, False: 2]
-                           // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-20]]:15): [True: 0, False: 1]
-  return c && d && e && f && g;
-                           // CHECK: |  Branch ([[@LINE-1]]:10): [True: 0, False: 3]
-                           // CHECK: |  Branch ([[@LINE-2]]:15): [True: 0, False: 0]
-                           // CHECK: |  Branch ([[@LINE-3]]:20): [True: 0, False: 0]
-                           // CHECK: |  Branch ([[@LINE-4]]:25): [True: 0, False: 0]
-                           // CHECK: |  Branch ([[@LINE-5]]:30): [True: 0, False: 0]
-}
-
-
-bool func2(int a, int b) {
-    bool h = MACRO3 || COND4;  // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-32]]:15): [True: 1, False: 2]
-                               // CHECK: |  |  |  |  |  |  |  |  |  |  |  Branch ([[@LINE-32]]:15): [True: 0, False: 1]
-                               // CHECK: |  |  |  |  |  |  |  Branch ([[@LINE-34]]:15): [True: 1, False: 2]
-                               // CHECK: |  |  |  |  |  |  |  Branch ([[@LINE-34]]:15): [True: 0, False: 1]
-                               // CHECK: |  |  |  Branch ([[@LINE-33]]:15): [True: 1, False: 2]
-  return h;
-}
-
-extern "C" { extern void __llvm_profile_write_file(void); }
-int main(int argc, char *argv[])
-{
-  func(atoi(argv[1]), atoi(argv[2]));
-  func2(atoi(argv[1]), atoi(argv[2]));
-  __llvm_profile_write_file();
-  return 0;
-}
-
-// REPORT: Name                        Regions    Miss   Cover     Lines    Miss   Cover  Branches    Miss   Cover
-// REPORT-NEXT: ---
-// REPORT-NEXT: _Z4funcii                        28       4  85.71%        18       0 100.00%        30      14  53.33%
-// REPORT-NEXT: _Z5func2ii                       13       1  92.31%         8       0 100.00%        10       2  80.00%
-// REPORT-NEXT: main                              1       0 100.00%         6       0 100.00%         0       0   0.00%
-// REPORT-NEXT: ---
-// REPORT-NEXT: TOTAL                            42       5  88.10%        32       0 100.00% 40      16  60.00%
diff --git a/llvm/test/tools/llvm-cov/branch-macros.test b/llvm/test/tools/llvm-cov/branch-macros.test
new file mode 100644
index 00000000000000..547a79ff941241
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/branch-macros.test
@@ -0,0 +1,12 @@
+// RUN: llvm-profdata merge %S/Inputs/branch-macros.proftext -o %t.profdata
+// RUN: llvm-cov show --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -check-prefixes=CHECK,BRCOV -D#C=999
+// RUN: llvm-cov show --binary-counters=true --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -check-prefixes=CHECK,BRCOV -D#C=1
+// RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S/Inputs %S/Inputs/branch-macros.cpp | FileCheck %s -check-prefix=REPORT
+
+// REPORT:      Name                        Regions    Miss   Cover     Lines    Miss   Cover  Branches    Miss   Cover
+// REPORT-NEXT: ---
+// REPORT-NEXT: _Z4funcii                        28       4  85.71%        18       0 100.00%        30      14  53.33%
+// REPORT-NEXT: _Z5func2ii                       13       1  92.31%         8       0 100.00%        10       2  80.00%
+// REPORT-NEXT: main                              1       0 100.00%         6       0 100.00%         0       0   0.00%
+// REPORT-NEXT: ---
+// REPORT-NEXT: TOTAL                            42       5  88.10%        32       0 100.00%        40      16  60.00%
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
deleted file mode 100644
index f72a9978b8a734..00000000000000
--- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-// Basic handling of line counts.
-// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
-
-// before any coverage              // WHOLE-FILE: [[@LINE]]|      |// before
-                                    // FILTER-NOT: [[@LINE-1]]|    |// before
-int main() {                              // TEXT: [[@LINE]]|   161|int main(
-  int x = 0;                              // TEXT: [[@LINE]]|   161|  int x
-                                          // TEXT: [[@LINE]]|   161|
-  if (x) {                                // TEXT: [[@LINE]]|   161|  if (x)
-    x = 0;                                // TEXT: [[@LINE]]|     0|    x = 0
-  } else {                                // TEXT: [[@LINE]]|   161|  } else
-    x = 1;                                // TEXT: [[@LINE]]|   161|    x = 1
-  }                                       // TEXT: [[@LINE]]|   161|  }
-                                          // TEXT: [[@LINE]]|   161|
-  for (int i = 0; i < 100; ++i) {         // TEXT: [[@LINE]]| 16.2k|  for (
-    x = 1;                                // TEXT: [[@LINE]]| 16.1k|    x = 1
-  }                                       // TEXT: [[@LINE]]| 16.1k|  }
-                                          // TEXT: [[@LINE]]|   161|
-  x = x < 10 ? x + 1 : x - 1;             // TEXT: [[@LINE]]|   161|  x =
-  x = x > 10 ?                            // TEXT: [[@LINE]]|   161|  x =
-        x - 1:                            // TEXT: [[@LINE]]|     0|        x
-        x + 1;                            // TEXT: [[@LINE]]|   161|        x
-                                          // TEXT: [[@LINE]]|   161|
-  return 0;                               // TEXT: [[@LINE]]|   161|  return
-}                                         // TEXT: [[@LINE]]|   161|}
-// after coverage                   // WHOLE-FILE: [[@LINE]]|      |// after
-                                    // FILTER-NOT: [[@LINE-1]]|    |// after
-
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S %s | FileCheck -check-prefixes=TEXT,WHOLE-FILE %s
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s | FileCheck -check-prefixes=TEXT,FILTER %s
-
-// Test -output-dir.
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %s
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -output-dir %t.filtered.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s
-// RUN: FileCheck -check-prefixes=TEXT,WHOLE-FILE -input-file %t.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
-// RUN: FileCheck -check-prefixes=TEXT,FILTER -input-file %t.filtered.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %s
-//
-// RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata 2>/dev/null -summary-only > %t.export-summary.json
-// RUN: not grep '"name":"main"' %t.export-summary.json
-//
-// Test html output.
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %s
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.html.filtered.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S -name=main %s
-// RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.html.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
-// RUN: FileCheck -check-prefixes=HTML,HTML-FILTER -input-file %t.html.filtered.dir/coverage/tmp/showLineExecutionCounts.cpp.html %s
-//
-// HTML-WHOLE-FILE: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// before
-// HTML-FILTER-NOT: <td class='line-number'><a name='L4' href='#L4'><pre>4</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// before
-// HTML: <td class='line-number'><a name='L6' href='#L6'><pre>6</pre></a></td><td class='covered-line'><pre>161</pre></td><td class='code'><pre>int main() {
-// HTML-WHOLE-FILE: <td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// after
-// HTML-FILTER-NOT: <td class='line-number'><a name='L26' href='#L26'><pre>26</pre></a></td><td class='skipped-line'></td><td class='code'><pre>// after
-//
-// Test index creation.
-// RUN: FileCheck -check-prefix=TEXT-INDEX -input-file %t.dir/index.txt %s
-// TEXT-INDEX: Filename
-// TEXT-INDEX-NEXT: ---
-// TEXT-INDEX-NEXT: {{.*}}showLineExecutionCounts.cpp
-//
-// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.html.dir/index.html %s
-// HTML-INDEX-LABEL: <table>
-// HTML-INDEX: <td class='column-entry-bold'>Filename</td>
-// HTML-INDEX: <td class='column-entry-bold'>Function Coverage</td>
-// HTML-INDEX: <td class='column-entry-bold'>Line Coverage</td>
-// HTML-INDEX: <td class='column-entry-bold'>Region Coverage</td>
-// HTML-INDEX: <a href='coverage{{.*}}showLineExecutionCounts.cpp.html'{{.*}}showLineExecutionCounts.cpp</a>
-// HTML-INDEX: <td class='column-entry-green'>
-// HTML-INDEX: 100.00% (1/1)
-// HTML-INDEX: <td class='column-entry-yellow'>
-// HTML-INDEX: 90.00% (18/20)
-// HTML-INDEX: <td class='column-entry-red'>
-// HTML-INDEX: 72.73% (8/11)
-// HTML-INDEX: <tr class='light-row-bold'>
-// HTML-INDEX: Totals
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.test b/llvm/test/tools/llvm-cov/showLineExecutionCounts.test
new file mode 100644
index 00000000000000..3c24ec2094c974
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.test
@@ -0,0 +1,46 @@
+// Basic handling of line counts.
+// RUN: rm -rf %t.dir
+// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
+
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=999 -DC16K2=16.2k -DC16K1=16.1k %S/Inputs/showLineExecutionCounts.cpp
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -binary-counters=true -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=1 -DC16K2=1 -DC16K1=1 %S/Inputs/showLineExecutionCounts.cpp
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main | FileCheck -check-prefixes=TEXT,FILTER -D#C=999 -DC16K2=16.2k -DC16K1=16.1k %S/Inputs/showLineExecutionCounts.cpp
+
+// Test -output-dir.
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t.dir/show -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -output-dir %t.dir/show.filtered -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main
+// RUN: FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=999 -DC16K2=16.2k -DC16K1=16.1k -input-file %t.dir/show/coverage/tmp/showLineExecutionCounts.cpp.txt %S/Inputs/showLineExecutionCounts.cpp
+// RUN: FileCheck -check-prefixes=TEXT,FILTER -D#C=999 -DC16K2=16.2k -DC16K1=16.1k -input-file %t.dir/show.filtered/coverage/tmp/showLineExecutionCounts.cpp.txt %S/Inputs/showLineExecutionCounts.cpp
+//
+// RUN: llvm-cov export %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata 2>/dev/null -summary-only > %t.export-summary.json
+// RUN: not grep '"name":"main"' %t.export-summary.json
+//
+// Test html output.
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html.binary -binary-counters=true -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html.filtered -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main
+// RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.dir/html/coverage/tmp/showLineExecutionCounts.cpp.html %S/Inputs/showLineExecutionCounts.cpp
+// RUN: FileCheck -check-prefixes=HTML-BINARY,HTML-WHOLE-FILE -input-file %t.dir/html.binary/coverage/tmp/showLineExecutionCounts.cpp.html %S/Inputs/showLineExecutionCounts.cpp
+// RUN: FileCheck -check-prefixes=HTML,HTML-FILTER -input-file %t.dir/html.filtered/coverage/tmp/showLineExecutionCounts.cpp.html %S/Inputs/showLineExecutionCounts.cpp
+//
+// Test index creation.
+// RUN: FileCheck -check-prefix=TEXT-INDEX -input-file %t.dir/show/index.txt %s
+// TEXT-INDEX: Filename
+// TEXT-INDEX-NEXT: ---
+// TEXT-INDEX-NEXT: {{.*}}showLineExecutionCounts.cpp
+//
+// RUN: FileCheck -check-prefix HTML-INDEX -input-file %t.dir/html/index.html %s
+// HTML-INDEX-LABEL: <table>
+// HTML-INDEX: <td class='column-entry-bold'>Filename</td>
+// HTML-INDEX: <td class='column-entry-bold'>Function Coverage</td>
+// HTML-INDEX: <td class='column-entry-bold'>Line Coverage</td>
+// HTML-INDEX: <td class='column-entry-bold'>Region Coverage</td>
+// HTML-INDEX: <a href='coverage{{.*}}showLineExecutionCounts.cpp.html'{{.*}}showLineExecutionCounts.cpp</a>
+// HTML-INDEX: <td class='column-entry-green'>
+// HTML-INDEX: 100.00% (1/1)
+// HTML-INDEX: <td class='column-entry-yellow'>
+// HTML-INDEX: 90.00% (18/20)
+// HTML-INDEX: <td class='column-entry-red'>
+// HTML-INDEX: 72.73% (8/11)
+// HTML-INDEX: <tr class='light-row-bold'>
+// HTML-INDEX: Totals
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 5db5c2e0235419..0e8360a4ac6ed9 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -1023,6 +1023,11 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
   cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
                                  cl::aliasopt(ShowOutputDirectory));
 
+  cl::opt<bool> BinaryCounters(
+      "binary-counters", cl::Optional,
+      cl::desc("Show 1/0 instead of actual counter values."),
+      cl::cat(ViewCategory));
+
   cl::opt<uint32_t> TabSize(
       "tab-size", cl::init(2),
       cl::desc(
@@ -1100,6 +1105,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
   ViewOpts.ShowFunctionInstantiations = ShowInstantiations;
   ViewOpts.ShowDirectoryCoverage = ShowDirectoryCoverage;
   ViewOpts.ShowOutputDirectory = ShowOutputDirectory;
+  ViewOpts.BinaryCounters = BinaryCounters;
   ViewOpts.TabSize = TabSize;
   ViewOpts.ProjectTitle = ProjectTitle;
 
diff --git a/llvm/tools/llvm-cov/CoverageViewOptions.h b/llvm/tools/llvm-cov/CoverageViewOptions.h
index 6925cffd8246d2..b8d1a8b2d7c9b5 100644
--- a/llvm/tools/llvm-cov/CoverageViewOptions.h
+++ b/llvm/tools/llvm-cov/CoverageViewOptions.h
@@ -45,6 +45,7 @@ struct CoverageViewOptions {
   bool SkipExpansions;
   bool SkipFunctions;
   bool SkipBranches;
+  bool BinaryCounters;
   OutputFormat Format;
   BranchOutputType ShowBranches;
   std::string ShowOutputDirectory;
diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h
index 2b1570d399dd0b..9b72ca03c6d7ff 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.h
+++ b/llvm/tools/llvm-cov/SourceCoverageView.h
@@ -180,6 +180,8 @@ class SourceCoverageView {
   /// on display.
   std::vector<InstantiationView> InstantiationSubViews;
 
+  bool BinaryCounters;
+
   /// Get the first uncovered line number for the source file.
   unsigned getFirstUncoveredLineNo();
 
@@ -266,6 +268,10 @@ class SourceCoverageView {
   /// digits.
   static std::string formatCount(uint64_t N);
 
+  uint64_t Count1(uint64_t N) const { return (N && BinaryCounters ? 1 : N); }
+
+  std::string formatCount1(uint64_t N) const { return formatCount(Count1(N)); }
+
   /// Check if region marker output is expected for a line.
   bool shouldRenderRegionMarkers(const LineCoverageStats &LCS) const;
 
@@ -276,7 +282,8 @@ class SourceCoverageView {
                      const CoverageViewOptions &Options,
                      CoverageData &&CoverageInfo)
       : SourceName(SourceName), File(File), Options(Options),
-        CoverageInfo(std::move(CoverageInfo)) {}
+        CoverageInfo(std::move(CoverageInfo)),
+        BinaryCounters(Options.BinaryCounters) {}
 
 public:
   static std::unique_ptr<SourceCoverageView>
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index e2be576b93cdaf..f3aa7e801597c9 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -1019,19 +1019,22 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
     // Just consider the segments which start *and* end on this line.
     for (unsigned I = 0, E = Segments.size() - 1; I < E; ++I) {
       const auto *CurSeg = Segments[I];
+      auto CurSegCount = Count1(CurSeg->Count);
+      auto LCSCount = Count1(LCS.getExecutionCount());
       if (!CurSeg->IsRegionEntry)
         continue;
-      if (CurSeg->Count == LCS.getExecutionCount())
+      if (CurSegCount == LCSCount)
         continue;
 
       Snippets[I + 1] =
-          tag("div", Snippets[I + 1] + tag("span", formatCount(CurSeg->Count),
-                                           "tooltip-content"),
+          tag("div",
+              Snippets[I + 1] +
+                  tag("span", formatCount(CurSegCount), "tooltip-content"),
               "tooltip");
 
       if (getOptions().Debug)
         errs() << "Marker at " << CurSeg->Line << ":" << CurSeg->Col << " = "
-               << formatCount(CurSeg->Count) << "\n";
+               << formatCount(CurSegCount) << "\n";
     }
   }
 
@@ -1051,7 +1054,7 @@ void SourceCoverageViewHTML::renderLineCoverageColumn(
     raw_ostream &OS, const LineCoverageStats &Line) {
   std::string Count;
   if (Line.isMapped())
-    Count = tag("pre", formatCount(Line.getExecutionCount()));
+    Count = tag("pre", formatCount1(Line.getExecutionCount()));
   std::string CoverageClass =
       (Line.getExecutionCount() > 0)
           ? "covered-line"
@@ -1106,7 +1109,7 @@ void SourceCoverageViewHTML::renderBranchView(raw_ostream &OS, BranchView &BRV,
 
     OS << tag("span", Label, (Count ? "None" : "red branch")) << ": ";
     if (getOptions().ShowBranchCounts)
-      OS << tag("span", formatCount(Count),
+      OS << tag("span", formatCount1(Count),
                 (Count ? "covered-line" : "uncovered-line"));
     else
       OS << format("%0.2f", (Total != 0 ? 100.0 * Count / Total : 0.0)) << "%";
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index 63f8248e3387ba..f0c366e45c2c92 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -216,7 +216,7 @@ void SourceCoverageViewText::renderLineCoverageColumn(
     OS.indent(LineCoverageColumnWidth) << '|';
     return;
   }
-  std::string C = formatCount(Line.getExecutionCount());
+  std::string C = formatCount1(Line.getExecutionCount());
   OS.indent(LineCoverageColumnWidth - C.size());
   colored_ostream(OS, raw_ostream::MAGENTA,
                   Line.hasMultipleRegions() && getOptions().Colors)
@@ -263,7 +263,7 @@ void SourceCoverageViewText::renderRegionMarkers(raw_ostream &OS,
 
     if (getOptions().Debug)
       errs() << "Marker at " << S->Line << ":" << S->Col << " = "
-            << formatCount(S->Count) << "\n";
+             << formatCount1(S->Count) << "\n";
   }
   OS << '\n';
 }
@@ -307,7 +307,7 @@ void SourceCoverageViewText::renderBranchView(raw_ostream &OS, BranchView &BRV,
         << Label;
 
     if (getOptions().ShowBranchCounts)
-      OS << ": " << formatCount(Count);
+      OS << ": " << formatCount1(Count);
     else
       OS << ": " << format("%0.2f", (Total != 0 ? 100.0 * Count / Total : 0.0))
          << "%";

>From 47550d1cc07ba6407020d2a9417bb48bdc3a5156 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Sun, 22 Dec 2024 11:32:00 +0900
Subject: [PATCH 2/6] threads.c => threads.test (following #113114)

---
 llvm/test/tools/llvm-cov/threads.c    | 11 -----------
 llvm/test/tools/llvm-cov/threads.test | 12 ++++++++++++
 2 files changed, 12 insertions(+), 11 deletions(-)
 delete mode 100644 llvm/test/tools/llvm-cov/threads.c
 create mode 100644 llvm/test/tools/llvm-cov/threads.test

diff --git a/llvm/test/tools/llvm-cov/threads.c b/llvm/test/tools/llvm-cov/threads.c
deleted file mode 100644
index b162b6ac5a8011..00000000000000
--- a/llvm/test/tools/llvm-cov/threads.c
+++ /dev/null
@@ -1,11 +0,0 @@
-// Coverage/profile data recycled from the showLineExecutionCounts.cpp test.
-//
-// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -j 1 -o %t1.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %S/showLineExecutionCounts.cpp
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -num-threads 2 -o %t2.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %S/showLineExecutionCounts.cpp
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t3.dir -instr-profile %t.profdata -path-equivalence=/tmp,%S %S/showLineExecutionCounts.cpp
-//
-// RUN: diff %t1.dir/index.txt %t2.dir/index.txt
-// RUN: diff %t1.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %t2.dir/coverage/tmp/showLineExecutionCounts.cpp.txt
-// RUN: diff %t1.dir/index.txt %t3.dir/index.txt
-// RUN: diff %t1.dir/coverage/tmp/showLineExecutionCounts.cpp.txt %t3.dir/coverage/tmp/showLineExecutionCounts.cpp.txt
diff --git a/llvm/test/tools/llvm-cov/threads.test b/llvm/test/tools/llvm-cov/threads.test
new file mode 100644
index 00000000000000..a51406ca14efa9
--- /dev/null
+++ b/llvm/test/tools/llvm-cov/threads.test
@@ -0,0 +1,12 @@
+// Coverage/profile data recycled from the showLineExecutionCounts.cpp test.
+//
+// RUN: rm -rf %t.dir
+// RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -j 1 -o %t.dir/1 -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -num-threads 2 -o %t.dir/2 -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -o %t.dir/3 -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+//
+// RUN: diff %t.dir/1/index.txt %t.dir/2/index.txt
+// RUN: diff %t.dir/1/coverage/tmp/showLineExecutionCounts.cpp.txt %t.dir/2/coverage/tmp/showLineExecutionCounts.cpp.txt
+// RUN: diff %t.dir/1/index.txt %t.dir/3/index.txt
+// RUN: diff %t.dir/1/coverage/tmp/showLineExecutionCounts.cpp.txt %t.dir/3/coverage/tmp/showLineExecutionCounts.cpp.txt

>From f4dc4ebfd585869455be0e9f37294b7037ca9a65 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Mon, 23 Dec 2024 15:57:36 +0900
Subject: [PATCH 3/6] s/Count1/BinaryCount/

---
 llvm/tools/llvm-cov/SourceCoverageView.h       | 8 ++++++--
 llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp | 8 ++++----
 llvm/tools/llvm-cov/SourceCoverageViewText.cpp | 6 +++---
 3 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/llvm/tools/llvm-cov/SourceCoverageView.h b/llvm/tools/llvm-cov/SourceCoverageView.h
index 9b72ca03c6d7ff..0b4e3978a4ba9c 100644
--- a/llvm/tools/llvm-cov/SourceCoverageView.h
+++ b/llvm/tools/llvm-cov/SourceCoverageView.h
@@ -268,9 +268,13 @@ class SourceCoverageView {
   /// digits.
   static std::string formatCount(uint64_t N);
 
-  uint64_t Count1(uint64_t N) const { return (N && BinaryCounters ? 1 : N); }
+  uint64_t BinaryCount(uint64_t N) const {
+    return (N && BinaryCounters ? 1 : N);
+  }
 
-  std::string formatCount1(uint64_t N) const { return formatCount(Count1(N)); }
+  std::string formatBinaryCount(uint64_t N) const {
+    return formatCount(BinaryCount(N));
+  }
 
   /// Check if region marker output is expected for a line.
   bool shouldRenderRegionMarkers(const LineCoverageStats &LCS) const;
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
index f3aa7e801597c9..c94d3853fc0143 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewHTML.cpp
@@ -1019,8 +1019,8 @@ void SourceCoverageViewHTML::renderLine(raw_ostream &OS, LineRef L,
     // Just consider the segments which start *and* end on this line.
     for (unsigned I = 0, E = Segments.size() - 1; I < E; ++I) {
       const auto *CurSeg = Segments[I];
-      auto CurSegCount = Count1(CurSeg->Count);
-      auto LCSCount = Count1(LCS.getExecutionCount());
+      auto CurSegCount = BinaryCount(CurSeg->Count);
+      auto LCSCount = BinaryCount(LCS.getExecutionCount());
       if (!CurSeg->IsRegionEntry)
         continue;
       if (CurSegCount == LCSCount)
@@ -1054,7 +1054,7 @@ void SourceCoverageViewHTML::renderLineCoverageColumn(
     raw_ostream &OS, const LineCoverageStats &Line) {
   std::string Count;
   if (Line.isMapped())
-    Count = tag("pre", formatCount1(Line.getExecutionCount()));
+    Count = tag("pre", formatBinaryCount(Line.getExecutionCount()));
   std::string CoverageClass =
       (Line.getExecutionCount() > 0)
           ? "covered-line"
@@ -1109,7 +1109,7 @@ void SourceCoverageViewHTML::renderBranchView(raw_ostream &OS, BranchView &BRV,
 
     OS << tag("span", Label, (Count ? "None" : "red branch")) << ": ";
     if (getOptions().ShowBranchCounts)
-      OS << tag("span", formatCount1(Count),
+      OS << tag("span", formatBinaryCount(Count),
                 (Count ? "covered-line" : "uncovered-line"));
     else
       OS << format("%0.2f", (Total != 0 ? 100.0 * Count / Total : 0.0)) << "%";
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
index f0c366e45c2c92..765f8bbbd8d1b5 100644
--- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
+++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp
@@ -216,7 +216,7 @@ void SourceCoverageViewText::renderLineCoverageColumn(
     OS.indent(LineCoverageColumnWidth) << '|';
     return;
   }
-  std::string C = formatCount1(Line.getExecutionCount());
+  std::string C = formatBinaryCount(Line.getExecutionCount());
   OS.indent(LineCoverageColumnWidth - C.size());
   colored_ostream(OS, raw_ostream::MAGENTA,
                   Line.hasMultipleRegions() && getOptions().Colors)
@@ -263,7 +263,7 @@ void SourceCoverageViewText::renderRegionMarkers(raw_ostream &OS,
 
     if (getOptions().Debug)
       errs() << "Marker at " << S->Line << ":" << S->Col << " = "
-             << formatCount1(S->Count) << "\n";
+             << formatBinaryCount(S->Count) << "\n";
   }
   OS << '\n';
 }
@@ -307,7 +307,7 @@ void SourceCoverageViewText::renderBranchView(raw_ostream &OS, BranchView &BRV,
         << Label;
 
     if (getOptions().ShowBranchCounts)
-      OS << ": " << formatCount1(Count);
+      OS << ": " << formatBinaryCount(Count);
     else
       OS << ": " << format("%0.2f", (Total != 0 ? 100.0 * Count / Total : 0.0))
          << "%";

>From 822620bea235792675202045b2b7d138aa069f0e Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Mon, 23 Dec 2024 15:55:49 +0900
Subject: [PATCH 4/6] Update desc

---
 llvm/tools/llvm-cov/CodeCoverage.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 0e8360a4ac6ed9..2d6da7efc69798 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -1025,7 +1025,8 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
 
   cl::opt<bool> BinaryCounters(
       "binary-counters", cl::Optional,
-      cl::desc("Show 1/0 instead of actual counter values."),
+      cl::desc("Show when lines/branches are covered (1) or uncovered (0) "
+               "instead of showing actual counter values."),
       cl::cat(ViewCategory));
 
   cl::opt<uint32_t> TabSize(

>From 714690db83179b8792c00c720c5da199bb4d8599 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Fri, 27 Dec 2024 19:39:03 +0900
Subject: [PATCH 5/6] Update desc

---
 llvm/tools/llvm-cov/CodeCoverage.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 2d6da7efc69798..921f283deedc73 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -1025,8 +1025,8 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
 
   cl::opt<bool> BinaryCounters(
       "binary-counters", cl::Optional,
-      cl::desc("Show when lines/branches are covered (1) or uncovered (0) "
-               "instead of showing actual counter values."),
+      cl::desc("Show binary counters (1/0) in lines and branches instead of "
+               "integer execution counts"),
       cl::cat(ViewCategory));
 
   cl::opt<uint32_t> TabSize(

>From b11ff81e5641588b51096bc2f7f74f24e1e3c8f3 Mon Sep 17 00:00:00 2001
From: NAKAMURA Takumi <geek4civic at gmail.com>
Date: Fri, 27 Dec 2024 19:40:54 +0900
Subject: [PATCH 6/6] Strip `=true` on `--binary-counters`

---
 llvm/test/tools/llvm-cov/branch-macros.test           | 2 +-
 llvm/test/tools/llvm-cov/showLineExecutionCounts.test | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/test/tools/llvm-cov/branch-macros.test b/llvm/test/tools/llvm-cov/branch-macros.test
index ec50bf951bc1bf..b16ef9d4846d87 100644
--- a/llvm/test/tools/llvm-cov/branch-macros.test
+++ b/llvm/test/tools/llvm-cov/branch-macros.test
@@ -1,6 +1,6 @@
 // RUN: llvm-profdata merge %S/Inputs/branch-macros.proftext -o %t.profdata
 // RUN: llvm-cov show --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -check-prefixes=CHECK,BRCOV -D#C=999
-// RUN: llvm-cov show --binary-counters=true --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -check-prefixes=CHECK,BRCOV -D#C=1
+// RUN: llvm-cov show --binary-counters --show-expansions --show-branches=count %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck %S/Inputs/branch-macros.cpp -check-prefixes=CHECK,BRCOV -D#C=1
 // RUN: llvm-cov report --show-branch-summary %S/Inputs/branch-macros.o32l -instr-profile %t.profdata -show-functions -path-equivalence=/tmp,%S/Inputs %S/Inputs/branch-macros.cpp | FileCheck %s -check-prefix=REPORT
 
 // RUN: yaml2obj %S/Inputs/branch-macros-single.yaml -o %t.o
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.test b/llvm/test/tools/llvm-cov/showLineExecutionCounts.test
index 43ed90dd5c3372..a165d8d670e55d 100644
--- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.test
+++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.test
@@ -3,7 +3,7 @@
 // RUN: llvm-profdata merge %S/Inputs/lineExecutionCounts.proftext -o %t.profdata
 
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=999 -DC16K2=16.2k -DC16K1=16.1k %S/Inputs/showLineExecutionCounts.cpp
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -binary-counters=true -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=1 -DC16K2=1 -DC16K1=1 %S/Inputs/showLineExecutionCounts.cpp
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -binary-counters -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs | FileCheck -check-prefixes=TEXT,WHOLE-FILE -D#C=1 -DC16K2=1 -DC16K1=1 %S/Inputs/showLineExecutionCounts.cpp
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main | FileCheck -check-prefixes=TEXT,FILTER -D#C=999 -DC16K2=16.2k -DC16K1=16.1k %S/Inputs/showLineExecutionCounts.cpp
 
 // Test -output-dir.
@@ -17,7 +17,7 @@
 //
 // Test html output.
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
-// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html.binary -binary-counters=true -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
+// RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html.binary -binary-counters -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -format html -o %t.dir/html.filtered -instr-profile %t.profdata -path-equivalence=/tmp,%S/Inputs -name=main
 // RUN: FileCheck -check-prefixes=HTML,HTML-WHOLE-FILE -input-file %t.dir/html/coverage/tmp/showLineExecutionCounts.cpp.html %S/Inputs/showLineExecutionCounts.cpp
 // RUN: FileCheck -check-prefixes=HTML-BINARY,HTML-WHOLE-FILE -input-file %t.dir/html.binary/coverage/tmp/showLineExecutionCounts.cpp.html %S/Inputs/showLineExecutionCounts.cpp



More information about the llvm-commits mailing list