InstrProf: Fix display of large numbers in llvm-cov

llvm-cov was truncating numbers that were larger than a particular
fixed width, which is as confusing as it is useless. Instead, we use
engineering notation with SI prefix for magnitude.

llvm-svn: 237307
diff --git a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext
index 1966d42..38387a6 100644
--- a/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/lineExecutionCounts.proftext
@@ -1,8 +1,8 @@
 main
 0x000000000028434d
 5
-1
+161
 0
-100
-1
+16100
+161
 0
diff --git a/llvm/test/tools/llvm-cov/Inputs/regionMarkers.proftext b/llvm/test/tools/llvm-cov/Inputs/regionMarkers.proftext
index 1966d42..5199edc 100644
--- a/llvm/test/tools/llvm-cov/Inputs/regionMarkers.proftext
+++ b/llvm/test/tools/llvm-cov/Inputs/regionMarkers.proftext
@@ -1,8 +1,8 @@
 main
 0x000000000028434d
 5
-1
+1111000
 0
-100
-1
+111100000
+1111000
 0
diff --git a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
index d5254da..83fee97 100644
--- a/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
+++ b/llvm/test/tools/llvm-cov/showLineExecutionCounts.cpp
@@ -1,30 +1,30 @@
 // 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() {                             // CHECK:   1| [[@LINE]]|int main(
-  int x = 0;                             // CHECK:   1| [[@LINE]]|  int x
-                                         // CHECK:   1| [[@LINE]]|
-  if (x) {                               // CHECK:   0| [[@LINE]]|  if (x)
-    x = 0;                               // CHECK:   0| [[@LINE]]|    x = 0
-  } else {                               // CHECK:   1| [[@LINE]]|  } else
-    x = 1;                               // CHECK:   1| [[@LINE]]|    x = 1
-  }                                      // CHECK:   1| [[@LINE]]|  }
-                                         // CHECK:   1| [[@LINE]]|
-  for (int i = 0; i < 100; ++i) {        // CHECK: 101| [[@LINE]]|  for (
-    x = 1;                               // CHECK: 100| [[@LINE]]|    x = 1
-  }                                      // CHECK: 100| [[@LINE]]|  }
-                                         // CHECK:   1| [[@LINE]]|
-  x = x < 10 ? x + 1 : x - 1;            // CHECK:   1| [[@LINE]]|  x =
-  x = x > 10 ?                           // CHECK:   1| [[@LINE]]|  x =
-        x - 1:                           // CHECK:   0| [[@LINE]]|        x
-        x + 1;                           // CHECK:   1| [[@LINE]]|        x
-                                         // CHECK:   1| [[@LINE]]|
-  return 0;                              // CHECK:   1| [[@LINE]]|  return
-}                                        // CHECK:   1| [[@LINE]]|}
-// after coverage                   // WHOLE-FILE:    | [[@LINE]]|// after
-                                    // FILTER-NOT:    | [[@LINE-1]]|// after
+// before any coverage              // WHOLE-FILE:      | [[@LINE]]|// before
+                                    // FILTER-NOT:      | [[@LINE-1]]|// before
+int main() {                             // CHECK:   161| [[@LINE]]|int main(
+  int x = 0;                             // CHECK:   161| [[@LINE]]|  int x
+                                         // CHECK:   161| [[@LINE]]|
+  if (x) {                               // CHECK:     0| [[@LINE]]|  if (x)
+    x = 0;                               // CHECK:     0| [[@LINE]]|    x = 0
+  } else {                               // CHECK:   161| [[@LINE]]|  } else
+    x = 1;                               // CHECK:   161| [[@LINE]]|    x = 1
+  }                                      // CHECK:   161| [[@LINE]]|  }
+                                         // CHECK:   161| [[@LINE]]|
+  for (int i = 0; i < 100; ++i) {        // CHECK: 16.2k| [[@LINE]]|  for (
+    x = 1;                               // CHECK: 16.1k| [[@LINE]]|    x = 1
+  }                                      // CHECK: 16.1k| [[@LINE]]|  }
+                                         // CHECK:   161| [[@LINE]]|
+  x = x < 10 ? x + 1 : x - 1;            // CHECK:   161| [[@LINE]]|  x =
+  x = x > 10 ?                           // CHECK:   161| [[@LINE]]|  x =
+        x - 1:                           // CHECK:     0| [[@LINE]]|        x
+        x + 1;                           // CHECK:   161| [[@LINE]]|        x
+                                         // CHECK:   161| [[@LINE]]|
+  return 0;                              // CHECK:   161| [[@LINE]]|  return
+}                                        // CHECK:   161| [[@LINE]]|}
+// after coverage                   // WHOLE-FILE:      | [[@LINE]]|// after
+                                    // FILTER-NOT:      | [[@LINE-1]]|// after
 
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence %s | FileCheck -check-prefix=CHECK -check-prefix=WHOLE-FILE %s
 // RUN: llvm-cov show %S/Inputs/lineExecutionCounts.covmapping -instr-profile %t.profdata -filename-equivalence -name=main %s | FileCheck -check-prefix=CHECK -check-prefix=FILTER %s
diff --git a/llvm/test/tools/llvm-cov/showRegionMarkers.cpp b/llvm/test/tools/llvm-cov/showRegionMarkers.cpp
index d1b83d2..5507367 100644
--- a/llvm/test/tools/llvm-cov/showRegionMarkers.cpp
+++ b/llvm/test/tools/llvm-cov/showRegionMarkers.cpp
@@ -1,23 +1,23 @@
 // RUN: llvm-profdata merge %S/Inputs/regionMarkers.proftext -o %t.profdata
 
-int main() {                      // CHECK: Marker at [[@LINE]]:12 = 1
+int main() {                      // CHECK: Marker at [[@LINE]]:12 = 1.11M
   int x = 0;
 
   if (x) {                        // CHECK: Marker at [[@LINE]]:10 = 0
     x = 0;
-  } else {                        // CHECK: Marker at [[@LINE]]:10 = 1
+  } else {                        // CHECK: Marker at [[@LINE]]:10 = 1.11M
     x = 1;
   }
-                                  // CHECK: Marker at [[@LINE+2]]:19 = 101
-                                  // CHECK: Marker at [[@LINE+1]]:28 = 100
-  for (int i = 0; i < 100; ++i) { // CHECK: Marker at [[@LINE]]:33 = 100
+                                  // CHECK: Marker at [[@LINE+2]]:19 = 112M
+                                  // CHECK: Marker at [[@LINE+1]]:28 = 111M
+  for (int i = 0; i < 100; ++i) { // CHECK: Marker at [[@LINE]]:33 = 111M
     x = 1;
   }
-                                  // CHECK: Marker at [[@LINE+1]]:16 = 1
+                                  // CHECK: Marker at [[@LINE+1]]:16 = 1.11M
   x = x < 10 ? x + 1 : x - 1;     // CHECK: Marker at [[@LINE]]:24 = 0
   x = x > 10 ?
         x - 1:                    // CHECK: Marker at [[@LINE]]:9 = 0
-        x + 1;                    // CHECK: Marker at [[@LINE]]:9 = 1
+        x + 1;                    // CHECK: Marker at [[@LINE]]:9 = 1.11M
 
   return 0;
 }