1821d7471SJustin Bogner# Compatibility tests for older profile format versions. These ensure
2821d7471SJustin Bogner# that we don't break compatibility with an older profile version
3821d7471SJustin Bogner# without noticing it.
4821d7471SJustin Bogner
5821d7471SJustin Bogner# The input file at %S/Inputs/compat.profdata.v1 was generated with
6821d7471SJustin Bogner# llvm-profdata merge from r214548.
7821d7471SJustin Bogner
8821d7471SJustin Bogner# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function function_count_only --counts | FileCheck %s -check-prefix=FUNC_COUNT_ONLY
9821d7471SJustin Bognerfunction_count_only
10821d7471SJustin Bogner0
11821d7471SJustin Bogner1
12821d7471SJustin Bogner97531
13821d7471SJustin Bogner# FUNC_COUNT_ONLY:      Hash: 0x{{0+$}}
14821d7471SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Counters: 1
15821d7471SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Function count: 97531
16821d7471SJustin Bogner# FUNC_COUNT_ONLY-NEXT: Block counts: []
17821d7471SJustin Bogner
18821d7471SJustin Bogner# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function "name with spaces" --counts | FileCheck %s -check-prefix=SPACES
19821d7471SJustin Bognername with spaces
20821d7471SJustin Bogner1024
21821d7471SJustin Bogner2
22821d7471SJustin Bogner0
23821d7471SJustin Bogner0
24821d7471SJustin Bogner# SPACES:      Hash: 0x{{0+}}400
25821d7471SJustin Bogner# SPACES-NEXT: Counters: 2
26821d7471SJustin Bogner# SPACES-NEXT: Function count: 0
27821d7471SJustin Bogner# SPACES-NEXT: Block counts: [0]
28821d7471SJustin Bogner
29821d7471SJustin Bogner# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 --function large_numbers --counts | FileCheck %s -check-prefix=LARGENUM
30821d7471SJustin Bognerlarge_numbers
31821d7471SJustin Bogner4611686018427387903
32821d7471SJustin Bogner6
33821d7471SJustin Bogner2305843009213693952
34821d7471SJustin Bogner1152921504606846976
35821d7471SJustin Bogner576460752303423488
36821d7471SJustin Bogner288230376151711744
37821d7471SJustin Bogner144115188075855872
38821d7471SJustin Bogner72057594037927936
39821d7471SJustin Bogner# LARGENUM:      Hash: 0x3fffffffffffffff
40821d7471SJustin Bogner# LARGENUM-NEXT: Counters: 6
41821d7471SJustin Bogner# LARGENUM-NEXT: Function count: 2305843009213693952
42821d7471SJustin Bogner# LARGENUM-NEXT: Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936]
43821d7471SJustin Bogner
44821d7471SJustin Bogner# RUN: llvm-profdata show %S/Inputs/compat.profdata.v1 | FileCheck %s -check-prefix=SUMMARY
45821d7471SJustin Bogner# SUMMARY: Total functions: 3
46821d7471SJustin Bogner# SUMMARY: Maximum function count: 2305843009213693952
47821d7471SJustin Bogner# SUMMARY: Maximum internal block count: 1152921504606846976
480f874636SXinliang David Li
490f874636SXinliang David Li# RUN: llvm-profdata show %S/Inputs/compat.profdata.v2 -all-functions --counts | FileCheck %s -check-prefix=FORMATV2
500f874636SXinliang David Li
510f874636SXinliang David Li# FORMATV2: Counters:
520f874636SXinliang David Li# FORMATV2-NEXT:   foo:
530f874636SXinliang David Li# FORMATV2-NEXT:     Hash: 0x000000000000000a
540f874636SXinliang David Li# FORMATV2-NEXT:     Counters: 2
550f874636SXinliang David Li# FORMATV2-NEXT:     Function count: 499500
560f874636SXinliang David Li# FORMATV2-NEXT:     Block counts: [179900]
570f874636SXinliang David Li# FORMATV2-NEXT:   main:
580f874636SXinliang David Li# FORMATV2-NEXT:     Hash: 0x000000000000410a
590f874636SXinliang David Li# FORMATV2-NEXT:     Counters: 4
600f874636SXinliang David Li# FORMATV2-NEXT:     Function count: 1
610f874636SXinliang David Li# FORMATV2-NEXT:     Block counts: [1000, 1000000, 499500]
62*852d12f3SAdam Nemet# FORMATV2-NEXT: Instrumentation level: Front-end
630f874636SXinliang David Li# FORMATV2-NEXT: Functions shown: 2
640f874636SXinliang David Li# FORMATV2-NEXT: Total functions: 2
650f874636SXinliang David Li# FORMATV2-NEXT: Maximum function count: 499500
660f874636SXinliang David Li# FORMATV2-NEXT: Maximum internal block count: 1000000
67876ed52cSXinliang David Li#
68876ed52cSXinliang David Li# RUN: llvm-profdata show %S/Inputs/compat.profdata.v4 -all-functions --counts | FileCheck %s -check-prefix=FORMATV4
690f874636SXinliang David Li
70876ed52cSXinliang David Li# FORMATV4: Counters:
71876ed52cSXinliang David Li# FORMATV4:   name with spaces:
72876ed52cSXinliang David Li# FORMATV4:     Hash: 0x0000000000000400
73876ed52cSXinliang David Li# FORMATV4:     Counters: 2
74876ed52cSXinliang David Li# FORMATV4:     Function count: 0
75876ed52cSXinliang David Li# FORMATV4:     Block counts: [0]
76876ed52cSXinliang David Li# FORMATV4:   function_count_only:
77876ed52cSXinliang David Li# FORMATV4:     Hash: 0x0000000000000000
78876ed52cSXinliang David Li# FORMATV4:     Counters: 1
79876ed52cSXinliang David Li# FORMATV4:     Function count: 97531
80876ed52cSXinliang David Li# FORMATV4:     Block counts: []
81876ed52cSXinliang David Li# FORMATV4:   large_numbers:
82876ed52cSXinliang David Li# FORMATV4:     Hash: 0x3fffffffffffffff
83876ed52cSXinliang David Li# FORMATV4:     Counters: 6
84876ed52cSXinliang David Li# FORMATV4:     Function count: 2305843009213693952
85876ed52cSXinliang David Li# FORMATV4:     Block counts: [1152921504606846976, 576460752303423488, 288230376151711744, 144115188075855872, 72057594037927936]
86876ed52cSXinliang David Li# FORMATV4: Functions shown: 3
87876ed52cSXinliang David Li# FORMATV4: Total functions: 3
88876ed52cSXinliang David Li# FORMATV4: Maximum function count: 2305843009213693952
89876ed52cSXinliang David Li# FORMATV4: Maximum internal block count: 1152921504606846976
90