[llvm] 481c3b8 - [llvm-dwarfdump] --statistics: break lines and indent by 2

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 22 13:58:27 PDT 2020


Author: Fangrui Song
Date: 2020-08-22T13:58:18-07:00
New Revision: 481c3b8c941c8c9fb2003e8f1f691e3c7774083a

URL: https://github.com/llvm/llvm-project/commit/481c3b8c941c8c9fb2003e8f1f691e3c7774083a
DIFF: https://github.com/llvm/llvm-project/commit/481c3b8c941c8c9fb2003e8f1f691e3c7774083a.diff

LOG: [llvm-dwarfdump] --statistics: break lines and indent by 2

so that the user does not have to pipe the output to `jq` or `python -m json.tool`.
This change makes testing more convenient because `-NEXT` patterns can be used.
The "prettify by default" is a good tradeoff to make. The output size increases a bit.

Differential Revision: https://reviews.llvm.org/D86318

Added: 
    

Modified: 
    llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
    llvm/test/tools/llvm-dwarfdump/X86/statistics-base-address.s
    llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
    llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
    llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-mulitple-cu-out-of-line.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-members.ll
    llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll
    llvm/tools/llvm-dwarfdump/Statistics.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll b/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
index 832ecbe219ca..6af1ac4e24d4 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/locstats.ll
@@ -1,88 +1,94 @@
 ; RUN: llc -debug-entry-values %s -o - -filetype=obj \
 ; RUN:   | llvm-dwarfdump -statistics - | FileCheck %s
 
-; CHECK: "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)":5
-; CHECK: "sum_all_params(#bytes in parent scope)":20
-; CHECK: "sum_all_params(#bytes in parent scope covered by DW_AT_location)":20
-; CHECK: "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)":5
-; CHECK: "sum_all_local_vars(#bytes in parent scope)":90
-; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":60
-; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)":0
-; CHECK: "#variables processed by location statistics":6
-; CHECK: "#variables with 0% of parent scope covered by DW_AT_location":1
-; CHECK: "#variables with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [50%,60%) of parent scope covered by DW_AT_location":1
-; CHECK: "#variables with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with [80%,90%) of parent scope covered by DW_AT_location":1
-; CHECK: "#variables with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables with 100% of parent scope covered by DW_AT_location":3
-; CHECK: "#variables - entry values with 0% of parent scope covered by DW_AT_location":1
-; CHECK: "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location":2
-; CHECK: "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location":1
-; CHECK: "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#variables - entry values with 100% of parent scope covered by DW_AT_location":2
-; CHECK: "#params processed by location statistics":2
-; CHECK: "#params with 0% of parent scope covered by DW_AT_location":0
-; CHECK: "#params with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [50%,60%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [80%,90%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params with 100% of parent scope covered by DW_AT_location":2
-; CHECK: "#params - entry values with 0% of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location":1
-; CHECK: "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#params - entry values with 100% of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars processed by location statistics":4
-; CHECK: "#local vars with 0% of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [50%,60%) of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with [80%,90%) of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars with 100% of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars - entry values with 0% of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location":1
-; CHECK: "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location":0
-; CHECK: "#local vars - entry values with 100% of parent scope covered by DW_AT_location":1
+; CHECK:      "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)": 5,
+; CHECK-NEXT: "sum_all_params(#bytes in parent scope)": 20,
+; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_AT_location)": 20,
+; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)": 5,
+; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope)": 90,
+; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 60,
+; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)": 0,
+; CHECK-NEXT: "#bytes within functions": 45,
+; CHECK-NEXT: "#bytes within inlined functions": 0,
+; CHECK-NEXT: "#params": 2,
+; CHECK-NEXT: "#params with source location": 2,
+; CHECK-NEXT: "#params with type": 2,
+; CHECK-NEXT: "#params with binary location": 2,
+; CHECK:      "#variables processed by location statistics": 6,
+; CHECK-NEXT: "#variables with 0% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#variables with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [50%,60%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#variables with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with [80%,90%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#variables with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables with 100% of parent scope covered by DW_AT_location": 3,
+; CHECK-NEXT: "#variables - entry values with 0% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location": 2,
+; CHECK-NEXT: "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#variables - entry values with 100% of parent scope covered by DW_AT_location": 2,
+; CHECK-NEXT: "#params processed by location statistics": 2,
+; CHECK-NEXT: "#params with 0% of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [50%,60%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [80%,90%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params with 100% of parent scope covered by DW_AT_location": 2,
+; CHECK-NEXT: "#params - entry values with 0% of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#params - entry values with 100% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars processed by location statistics": 4,
+; CHECK-NEXT: "#local vars with 0% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [50%,60%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with [80%,90%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars with 100% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars - entry values with 0% of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1,
+; CHECK-NEXT: "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0,
+; CHECK-NEXT: "#local vars - entry values with 100% of parent scope covered by DW_AT_location": 1
 
 ; The source code of the test case:
 ; extern void fn3(int *);

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/statistics-base-address.s b/llvm/test/tools/llvm-dwarfdump/X86/statistics-base-address.s
index ca9b7c9781e1..b9b4600f8737 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/statistics-base-address.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/statistics-base-address.s
@@ -5,8 +5,8 @@
 # RUN: llvm-mc -triple x86_64-pc-linux %s -filetype=obj -o %t
 # RUN: llvm-dwarfdump --statistics %t | FileCheck %s
 
-# CHECK: "sum_all_local_vars(#bytes in parent scope)":12
-# CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":8
+# CHECK: "sum_all_local_vars(#bytes in parent scope)": 12,
+# CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 8,
 
         .text
 

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test b/llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
index 619a280eae80..b55ca657ee32 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
+++ b/llvm/test/tools/llvm-dwarfdump/X86/statistics-dwo.test
@@ -69,28 +69,28 @@ RUN: llvm-dwarfdump --statistics statistics-fib.split-dwarf.o | FileCheck %s
 # }
 #
 
-CHECK: "version":5
-CHECK: "#functions":3
-CHECK: "#functions with location":3
-CHECK: "#inlined functions":7
-CHECK: "#inlined functions with abstract origins":7
-CHECK: "#unique source variables":9
-CHECK: "#source variables":30
+CHECK:      "version": 5,
+CHECK:      "#functions": 3,
+CHECK:      "#functions with location": 3,
+CHECK:      "#inlined functions": 7,
+CHECK:      "#inlined functions with abstract origins": 7,
+CHECK:      "#unique source variables": 9,
+CHECK:      "#source variables": 30,
 
 # Ideally the value below would be 33 but currently it's not.
-CHECK: "#source variables with location":22
-CHECK: "#call site entries":7
-CHECK: "sum_all_variables(#bytes in parent scope)":2817
-CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)":1160
-CHECK: "#bytes within functions":594
-CHECK: "#bytes within inlined functions":345
-CHECK: "#params":12
-CHECK: "#params with source location":12
-CHECK: "#params with type":12
-CHECK: "#params with binary location":12
-CHECK: "#local vars":18
-CHECK: "#local vars with source location":18
-CHECK: "#local vars with type":18
+CHECK:      "#source variables with location": 22,
+CHECK:      "#call site entries": 7,
+CHECK:      "sum_all_variables(#bytes in parent scope)": 2817,
+CHECK:      "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1160,
+CHECK:      "#bytes within functions": 594,
+CHECK:      "#bytes within inlined functions": 345,
+CHECK:      "#params": 12,
+CHECK-NEXT: "#params with source location": 12,
+CHECK-NEXT: "#params with type": 12,
+CHECK-NEXT: "#params with binary location": 12,
+CHECK-NEXT: "#local vars": 18,
+CHECK-NEXT: "#local vars with source location": 18,
+CHECK-NEXT: "#local vars with type": 18,
 
 # Ideally the value below would be 18, but currently it's not.
-CHECK: "#local vars with binary location":10
+CHECK:      "#local vars with binary location": 10,

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test b/llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
index fa6ce5b5a24e..26a8d8448705 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
+++ b/llvm/test/tools/llvm-dwarfdump/X86/statistics-v3.test
@@ -64,28 +64,28 @@ RUN: llvm-dwarfdump --statistics %t-statistics-fib.o | FileCheck %s
 # }
 #
 
-CHECK: "version":5
-CHECK: "#functions":3
-CHECK: "#functions with location":3
-CHECK: "#inlined functions":8
-CHECK: "#inlined functions with abstract origins":8
-CHECK: "#unique source variables":9
-CHECK: "#source variables":33
+CHECK:      "version": 5,
+CHECK:      "#functions": 3,
+CHECK:      "#functions with location": 3,
+CHECK:      "#inlined functions": 8,
+CHECK:      "#inlined functions with abstract origins": 8,
+CHECK:      "#unique source variables": 9,
+CHECK:      "#source variables": 33,
 
 # Ideally the value below would be 33 but currently it's not.
-CHECK: "#source variables with location":24
-CHECK: "#call site entries":8
-CHECK: "sum_all_variables(#bytes in parent scope)":3072
-CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)":1188
-CHECK: "#bytes within functions":636
-CHECK: "#bytes within inlined functions":388
-CHECK: "#params":13
-CHECK: "#params with source location":13
-CHECK: "#params with type":13
-CHECK: "#params with binary location":13
-CHECK: "#local vars":20
-CHECK: "#local vars with source location":20
-CHECK: "#local vars with type":20
+CHECK:      "#source variables with location": 24,
+CHECK:      "#call site entries": 8,
+CHECK:      "sum_all_variables(#bytes in parent scope)": 3072,
+CHECK:      "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1188,
+CHECK:      "#bytes within functions": 636,
+CHECK:      "#bytes within inlined functions": 388,
+CHECK:      "#params": 13,
+CHECK-NEXT: "#params with source location": 13,
+CHECK-NEXT: "#params with type": 13,
+CHECK-NEXT: "#params with binary location": 13,
+CHECK-NEXT: "#local vars": 20,
+CHECK-NEXT: "#local vars with source location": 20,
+CHECK-NEXT: "#local vars with type": 20,
 
 # Ideally the value below would be 20, but currently it's not.
-CHECK: "#local vars with binary location":11
+CHECK-NEXT: "#local vars with binary location": 11,

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll b/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
index e86f4333f06a..b4057413dd05 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
@@ -1,6 +1,6 @@
 ; RUN: llc -O0 %s -o - -filetype=obj \
 ; RUN:   | llvm-dwarfdump -statistics - | FileCheck %s
-; CHECK: "version":5
+; CHECK: "version": 5,
 
 ; namespace test {
 ;  extern int a;
@@ -41,24 +41,24 @@
 ;     - non-constant member S:fn,
 ;     - arguments of S:fn.
 
-; CHECK: "#unique source variables":10
+; CHECK:      "#unique source variables": 10,
 ; +1 extra inline i.
-; CHECK: "#source variables":11
+; CHECK:      "#source variables": 11,
 ; -1 square::i
-; CHECK: "#source variables with location":10
-; CHECK: "sum_all_local_vars(#bytes in parent scope)":[[BYTES:[0-9]+]]
+; CHECK:      "#source variables with location": 10,
+; CHECK:      "sum_all_local_vars(#bytes in parent scope)": [[BYTES:[0-9]+]]
 ; Because of the dbg.value in the middle of the function, the pc range coverage
 ; must be below 100%.
-; CHECK-NOT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":0
-; CHECK-NOT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":[[BYTES]]
-; CHECK: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":
-; CHECK: "#bytes within functions":[[FUNCSIZE:[0-9]+]]
-; CHECK: "#bytes within inlined functions":[[INLINESIZE:[0-9]+]]
-; CHECK: "#bytes in __debug_info":459
-; CHECK: "#bytes in __debug_loc":35
-; CHECK: "#bytes in __debug_abbrev":384
-; CHECK: "#bytes in __debug_line":126
-; CHECK: "#bytes in __debug_str":231
+; CHECK-NOT:  "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 0,
+; CHECK-NOT:  "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": [[BYTES]]
+; CHECK:      "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)":
+; CHECK:      "#bytes within functions": [[FUNCSIZE:[0-9]+]]
+; CHECK:      "#bytes within inlined functions": [[INLINESIZE:[0-9]+]]
+; CHECK:      "#bytes in __debug_info": 459,
+; CHECK-NEXT: "#bytes in __debug_loc": 35,
+; CHECK-NEXT: "#bytes in __debug_abbrev": 384,
+; CHECK-NEXT: "#bytes in __debug_line": 126,
+; CHECK-NEXT: "#bytes in __debug_str": 231,
 
 ; ModuleID = '/tmp/quality.cpp'
 source_filename = "/tmp/quality.cpp"

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
index 7f7e3438c14f..8a41c24ee851 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-dbg-callsite-info.ll
@@ -12,8 +12,8 @@
 ;   foo(&local1, arg2, 10, 15, arg3 + 3, arg1 + arg2);
 ; }
 ;
-; CHECK: "#call site DIEs":2
-; CHECK-SAME: "#call site parameter DIEs":6
+; CHECK:      "#call site DIEs": 2,
+; CHECK-NEXT: "#call site parameter DIEs": 6,
 ;
 ; ModuleID = 'test.c'
 source_filename = "test.c"

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
index 0615e867fca1..c1d3f24ddabc 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-multi-cu.ll
@@ -3,11 +3,11 @@
 
 ; Test that abstract origins in multiple CUs are uniqued.
 
-; CHECK:      "#functions":4,
-; CHECK-SAME: "#inlined functions":2,
-; CHECK-SAME: "#unique source variables":4
-; CHECK-SAME: "#source variables":6
-; CHECK-SAME: "#source variables with location":6
+; CHECK:      "#functions": 4,
+; CHECK:      "#inlined functions": 2,
+; CHECK:      "#unique source variables": 4,
+; CHECK-NEXT: "#source variables": 6,
+; CHECK-NEXT: "#source variables with location": 6,
 
 ;header.h:
 ;extern "C" int getchar();

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
index c56e6a55049a..88ab48b7429c 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-inlining-single-cu.ll
@@ -4,11 +4,11 @@
 ; This test serves as a baseline / sanity-check for stats-inlining-multi-cu.ll
 ; The results for both tests should be identical.
 
-; CHECK:      "#functions":4,
-; CHECK-SAME: "#inlined functions":2,
-; CHECK-SAME: "#unique source variables":4
-; CHECK-SAME: "#source variables":6
-; CHECK-SAME: "#source variables with location":6
+; CHECK:      "#functions": 4,
+; CHECK:      "#inlined functions": 2,
+; CHECK:      "#unique source variables": 4,
+; CHECK-NEXT: "#source variables": 6,
+; CHECK-NEXT: "#source variables with location": 6,
 
 ;header.h:
 ;extern "C" int getchar();

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-mulitple-cu-out-of-line.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-mulitple-cu-out-of-line.ll
index cc644d1bdb5c..40fda3214320 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-mulitple-cu-out-of-line.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-mulitple-cu-out-of-line.ll
@@ -18,12 +18,13 @@
 ; #include "test.h"
 ; int far() { return foo(42); }
 
-; CHECK:      "#functions":3
-; CHECK-SAME: "#functions with location":3
-; CHECK-SAME: "#inlined functions":0
-; CHECK-SAME: "#unique source variables":1
-; CHECK-SAME: "#source variables":2
-; CHECK-SAME: "#source variables with location":2
+; CHECK:      "#functions": 3,
+; CHECK-NEXT: "#functions with location": 3,
+; CHECK-NEXT: "#inlined functions": 0,
+; CHECK-NEXT: "#inlined functions with abstract origins": 0,
+; CHECK-NEXT: "#unique source variables": 1,
+; CHECK-NEXT: "#source variables": 2,
+; CHECK-NEXT: "#source variables with location": 2,
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
 target triple = "x86_64-unknown-linux-gnu"

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-members.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-members.ll
index c5ea22c48b45..297c6ec8e194 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-members.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-members.ll
@@ -16,8 +16,8 @@
 ; #include "test.h"
 ; s S2;
 
-; CHECK:      "#source variables":4
-; CHECK-SAME: "#source variables with location":4
+; CHECK:      "#source variables": 4,
+; CHECK:      "#source variables with location": 4,
 
 source_filename = "llvm-link"
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

diff  --git a/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll b/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll
index 6edda0512212..6653681b3701 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/stats-multiple-cu-same-name.ll
@@ -3,9 +3,9 @@
 
 ; Test that statistics distinguish functions with the same name.
 
-; CHECK:      "#functions":4,
-; CHECK-SAME: "#unique source variables":2
-; CHECK-SAME: "#source variables":2
+; CHECK:      "#functions": 4,
+; CHECK:      "#unique source variables": 2,
+; CHECK-NEXT: "#source variables": 2,
 
 ; $ cat test1.cpp
 ; static int foo(int a) {

diff  --git a/llvm/tools/llvm-dwarfdump/Statistics.cpp b/llvm/tools/llvm-dwarfdump/Statistics.cpp
index 41600c6222ea..2f080fe9ef3b 100644
--- a/llvm/tools/llvm-dwarfdump/Statistics.cpp
+++ b/llvm/tools/llvm-dwarfdump/Statistics.cpp
@@ -466,8 +466,7 @@ static void collectStatsRecursive(DWARFDie Die, std::string FnPrefix,
   }
 }
 
-/// Print machine-readable output.
-/// The machine-readable format is single-line JSON output.
+/// Print human-readable output.
 /// \{
 static void printDatum(json::OStream &J, const char *Key, json::Value Value) {
   J.attribute(Key, Value);
@@ -593,7 +592,7 @@ bool dwarfdump::collectStatsForObjectFile(ObjectFile &Obj, DWARFContext &DICtx,
 
   // Print summary.
   OS.SetBufferSize(1024);
-  json::OStream J(OS);
+  json::OStream J(OS, 2);
   J.objectBegin();
   J.attribute("version", Version);
   LLVM_DEBUG(llvm::dbgs() << "Variable location quality metrics\n";


        


More information about the llvm-commits mailing list