1 ; Firstly test uncompression(--compress-recursion=0)
2 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --compress-recursion=0 --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
3 ; RUN: FileCheck %s --input-file %t -check-prefix=CHECK-UNCOMPRESS
4 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --skip-symbolization --profile-summary-hot-count=0
5 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER
6 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
7 ; RUN: FileCheck %s --input-file %t
8 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe-nommap.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --skip-symbolization --profile-summary-hot-count=0
9 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER
10 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe-nommap.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
11 ; RUN: FileCheck %s --input-file %t
12 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --compress-recursion=0 --profile-summary-hot-count=0 --csprof-max-context-depth=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
13 ; RUN: FileCheck %s --input-file %t -check-prefix=CHECK-MAX-CTX-DEPTH
16 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa]:4:1
17 ; CHECK-UNCOMPRESS: 1: 1
18 ; CHECK-UNCOMPRESS: 3: 1
19 ; CHECK-UNCOMPRESS: 5: 1
20 ; CHECK-UNCOMPRESS: 8: 1 fa:1
21 ; CHECK-UNCOMPRESS: !CFGChecksum: 563070469352221
22 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa]:4:1
23 ; CHECK-UNCOMPRESS: 1: 1
24 ; CHECK-UNCOMPRESS: 3: 1
25 ; CHECK-UNCOMPRESS: 4: 1
26 ; CHECK-UNCOMPRESS: 7: 1 fb:1
27 ; CHECK-UNCOMPRESS: !CFGChecksum: 563070469352221
28 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:4:1
29 ; CHECK-UNCOMPRESS: 1: 1
30 ; CHECK-UNCOMPRESS: 3: 1
31 ; CHECK-UNCOMPRESS: 4: 1
32 ; CHECK-UNCOMPRESS: 7: 1 fb:1
33 ; CHECK-UNCOMPRESS: !CFGChecksum: 563070469352221
34 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
35 ; CHECK-UNCOMPRESS: 1: 1
36 ; CHECK-UNCOMPRESS: 2: 1
37 ; CHECK-UNCOMPRESS: 5: 1 fb:1
38 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
39 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
40 ; CHECK-UNCOMPRESS: 1: 1
41 ; CHECK-UNCOMPRESS: 2: 1
42 ; CHECK-UNCOMPRESS: 5: 1 fb:1
43 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
44 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
45 ; CHECK-UNCOMPRESS: 1: 1
46 ; CHECK-UNCOMPRESS: 2: 1
47 ; CHECK-UNCOMPRESS: 5: 1 fb:1
48 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
49 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1
50 ; CHECK-UNCOMPRESS: 1: 1
51 ; CHECK-UNCOMPRESS: 3: 1
52 ; CHECK-UNCOMPRESS: 6: 1 fa:1
53 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
54 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb]:3:1
55 ; CHECK-UNCOMPRESS: 1: 1
56 ; CHECK-UNCOMPRESS: 3: 1
57 ; CHECK-UNCOMPRESS: 6: 1 fa:1
58 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
59 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
60 ; CHECK-UNCOMPRESS: 1: 1
61 ; CHECK-UNCOMPRESS: 3: 1
62 ; CHECK-UNCOMPRESS: 6: 1 fa:1
63 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
64 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb:6 @ fa]:2:1
65 ; CHECK-UNCOMPRESS: 1: 1
66 ; CHECK-UNCOMPRESS: 3: 1
67 ; CHECK-UNCOMPRESS: !CFGChecksum: 563070469352221
68 ; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:1:0
69 ; CHECK-UNCOMPRESS: 5: 1 fb:1
70 ; CHECK-UNCOMPRESS: !CFGChecksum: 563022570642068
71 ; CHECK-MAX-CTX-DEPTH: [fb]:19:6
72 ; CHECK-MAX-CTX-DEPTH: 1: 6
73 ; CHECK-MAX-CTX-DEPTH: 2: 3
74 ; CHECK-MAX-CTX-DEPTH: 3: 3
75 ; CHECK-MAX-CTX-DEPTH: 4: 0
76 ; CHECK-MAX-CTX-DEPTH: 5: 4 fb:4
77 ; CHECK-MAX-CTX-DEPTH: 6: 3 fa:3
78 ; CHECK-MAX-CTX-DEPTH: !CFGChecksum: 563022570642068
79 ; CHECK-MAX-CTX-DEPTH: [fa]:14:4
80 ; CHECK-MAX-CTX-DEPTH: 1: 4
81 ; CHECK-MAX-CTX-DEPTH: 3: 4
82 ; CHECK-MAX-CTX-DEPTH: 4: 2
83 ; CHECK-MAX-CTX-DEPTH: 5: 1
84 ; CHECK-MAX-CTX-DEPTH: 6: 0
85 ; CHECK-MAX-CTX-DEPTH: 7: 2 fb:2
86 ; CHECK-MAX-CTX-DEPTH: 8: 1 fa:1
87 ; CHECK-MAX-CTX-DEPTH: !CFGChecksum: 563070469352221
90 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb]:13:4
96 ; CHECK !CFGChecksum: 563022570642068
97 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:6:2
102 ; CHECK: !CFGChecksum: 563070469352221
103 CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa]:4:1
108 ; CHECK: !CFGChecksum: 563070469352221
109 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa]:4:1
114 ; CHECK: !CFGChecksum: 563070469352221
115 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb]:3:1
119 ; CHECK: !CFGChecksum: 563022570642068
120 ; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1
124 ; CHECK: !CFGChecksum: 563022570642068
126 ; CHECK-UNWINDER: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab]
127 ; CHECK-UNWINDER-NEXT: 3
128 ; CHECK-UNWINDER-NEXT: 7a0-7a7:1
129 ; CHECK-UNWINDER-NEXT: 7a0-7ab:3
130 ; CHECK-UNWINDER-NEXT: 7b2-7b5:1
131 ; CHECK-UNWINDER-NEXT: 3
132 ; CHECK-UNWINDER-NEXT: 7a7->7b2:1
133 ; CHECK-UNWINDER-NEXT: 7ab->7a0:4
134 ; CHECK-UNWINDER-NEXT: 7b5->7c0:1
135 ; CHECK-UNWINDER-NEXT: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab @ 0x7b5]
136 ; CHECK-UNWINDER-NEXT: 1
137 ; CHECK-UNWINDER-NEXT: 7c0-7d4:1
138 ; CHECK-UNWINDER-NEXT: 1
139 ; CHECK-UNWINDER-NEXT: 7d4->7c0:1
140 ; CHECK-UNWINDER-NEXT: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab @ 0x7b5 @ 0x7d4]
141 ; CHECK-UNWINDER-NEXT: 2
142 ; CHECK-UNWINDER-NEXT: 7c0-7cd:1
143 ; CHECK-UNWINDER-NEXT: 7db-7e0:1
144 ; CHECK-UNWINDER-NEXT: 2
145 ; CHECK-UNWINDER-NEXT: 7cd->7db:1
146 ; CHECK-UNWINDER-NEXT: 7e0->7a0:1
147 ; CHECK-UNWINDER-NEXT: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab @ 0x7b5 @ 0x7d4 @ 0x7e0]
148 ; CHECK-UNWINDER-NEXT: 2
149 ; CHECK-UNWINDER-NEXT: 7a0-7a7:1
150 ; CHECK-UNWINDER-NEXT: 7b2-7b5:1
151 ; CHECK-UNWINDER-NEXT: 2
152 ; CHECK-UNWINDER-NEXT: 7a7->7b2:1
153 ; CHECK-UNWINDER-NEXT: 7b5->7c0:1
154 ; CHECK-UNWINDER-NEXT: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab @ 0x7b5 @ 0x7d4 @ 0x7e0 @ 0x7b5]
155 ; CHECK-UNWINDER-NEXT: 2
156 ; CHECK-UNWINDER-NEXT: 7c0-7cd:2
157 ; CHECK-UNWINDER-NEXT: 7db-7e0:1
158 ; CHECK-UNWINDER-NEXT: 2
159 ; CHECK-UNWINDER-NEXT: 7cd->7db:2
160 ; CHECK-UNWINDER-NEXT: 7e0->7a0:1
161 ; CHECK-UNWINDER-NEXT: [0x842 @ 0x7d4 @ 0x7e0 @ 0x7ab @ 0x7b5 @ 0x7d4 @ 0x7e0 @ 0x7b5 @ 0x7e0]
162 ; CHECK-UNWINDER-NEXT: 2
163 ; CHECK-UNWINDER-NEXT: 7a0-7a7:1
164 ; CHECK-UNWINDER-NEXT: 7b2-7b5:1
165 ; CHECK-UNWINDER-NEXT: 2
166 ; CHECK-UNWINDER-NEXT: 7a7->7b2:1
167 ; CHECK-UNWINDER-NEXT: 7b5->7c0:1
170 ; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling
171 ; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls
177 if(n > 10) return fb(n / 2);
183 if(n % 2) return fb(n - 1);
191 printf("sum is %d\n", s);