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