| 1 |
# Test of the llmv-dwarfdump --statistics with split dwarf (dwo files) |
| 2 |
# (version >= 3). |
| 3 |
# |
| 4 |
# Create a directory in which to put all files, so .o file can find .dwo file. |
| 5 |
RUN: rm -rf %t && mkdir -p %t |
| 6 |
RUN: cp -f %S/Inputs/statistics-fib.split-dwarf.s %t/. |
| 7 |
RUN: cd %t |
| 8 |
RUN: llvm-mc -triple x86_64-unknown-linux-gnu statistics-fib.split-dwarf.s -filetype=obj -split-dwarf-file statistics-fib.split-dwarf.dwo -o statistics-fib.split-dwarf.o |
| 9 |
RUN: llvm-dwarfdump --statistics statistics-fib.split-dwarf.o | FileCheck %s |
| 10 |
|
| 11 |
# Source program - A version of Fibonacci |
| 12 |
# Compilation options: -gsplit-dwarf -O3 -c -S |
| 13 |
# |
| 14 |
# int |
| 15 |
# real_fib (int x, int answers[11]) |
| 16 |
# { |
| 17 |
# int result; |
| 18 |
# |
| 19 |
# if ((answers)[x] != -1) |
| 20 |
# return (answers)[x]; |
| 21 |
# |
| 22 |
# result = real_fib(x-1, answers) + real_fib(x-2, answers); |
| 23 |
# (answers)[x] = result; |
| 24 |
# |
| 25 |
# return result; |
| 26 |
# } |
| 27 |
# |
| 28 |
# int |
| 29 |
# fib (int x) |
| 30 |
# { |
| 31 |
# int answers[11]; |
| 32 |
# int i; |
| 33 |
# |
| 34 |
# if (x > 10) |
| 35 |
# return -1; |
| 36 |
# |
| 37 |
# for (i = 0; i < 11; i++) |
| 38 |
# answers[i] = -1; |
| 39 |
# |
| 40 |
# answers[0] = 0; |
| 41 |
# answers[1] = 1; |
| 42 |
# answers[2] = 1; |
| 43 |
# |
| 44 |
# return real_fib(x, answers); |
| 45 |
# } |
| 46 |
# |
| 47 |
# int main (int argc, char **argv) |
| 48 |
# { |
| 49 |
# int result; |
| 50 |
# |
| 51 |
# result = fib(3); |
| 52 |
# printf ("fibonacci(3) = %d\n", result); |
| 53 |
# result = fib(4); |
| 54 |
# printf ("fibonacci(4) = %d\n", result); |
| 55 |
# result = fib(5); |
| 56 |
# printf ("fibonacci(5) = %d\n", result); |
| 57 |
# result = fib(6); |
| 58 |
# printf ("fibonacci(6) = %d\n", result); |
| 59 |
# result = fib(7); |
| 60 |
# printf ("fibonacci(7) = %d\n", result); |
| 61 |
# result = fib(8); |
| 62 |
# printf ("fibonacci(8) = %d\n", result); |
| 63 |
# result = fib(9); |
| 64 |
# printf ("fibonacci(9) = %d\n", result); |
| 65 |
# result = fib(10); |
| 66 |
# printf ("fibonacci(10) = %d\n", result); |
| 67 |
# |
| 68 |
# return 0; |
| 69 |
# } |
| 70 |
# |
| 71 |
|
| 72 |
CHECK: "version": 9, |
| 73 |
CHECK: "#functions": 3, |
| 74 |
CHECK: "#functions with location": 3, |
| 75 |
CHECK: "#out-of-line functions": 3, |
| 76 |
CHECK: "#inlined functions": 7, |
| 77 |
CHECK: "#inlined functions with abstract origins": 7, |
| 78 |
CHECK: "#unique source variables": 9, |
| 79 |
CHECK: "#source variables": 30, |
| 80 |
|
| 81 |
# Ideally the value below would be 33 but currently it's not. |
| 82 |
CHECK: "#source variables with location": 22, |
| 83 |
CHECK: "#call site entries": 7, |
| 84 |
CHECK: "sum_all_variables(#bytes in parent scope)": 2817, |
| 85 |
CHECK: "sum_all_variables(#bytes in parent scope covered by DW_AT_location)": 1160, |
| 86 |
CHECK: "#bytes within functions": 594, |
| 87 |
CHECK: "#bytes within inlined functions": 345, |
| 88 |
CHECK: "#params": 12, |
| 89 |
CHECK-NEXT: "#params with source location": 12, |
| 90 |
CHECK-NEXT: "#params with type": 12, |
| 91 |
CHECK-NEXT: "#params with binary location": 12, |
| 92 |
CHECK-NEXT: "#local vars": 18, |
| 93 |
CHECK-NEXT: "#local vars with source location": 18, |
| 94 |
CHECK-NEXT: "#local vars with type": 18, |
| 95 |
|
| 96 |
# Ideally the value below would be 18, but currently it's not. |
| 97 |
CHECK: "#local vars with binary location": 10, |