1 ; Firstly test uncompression(--compress-recursion=0)
2 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-noprobe.perfscript --binary=%S/Inputs/recursion-compression-noprobe.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-noprobe.perfscript --binary=%S/Inputs/recursion-compression-noprobe.perfbin --output=%t --profile-summary-hot-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0
5 ; RUN: FileCheck %s --input-file %t
6 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/recursion-compression-noprobe.perfscript --binary=%S/Inputs/recursion-compression-noprobe.perfbin --output=%t --compress-recursion=0 --profile-summary-hot-count=0 --csprof-max-context-depth=2 --csspgo-preinliner=0 --gen-cs-nested-profile=0
7 ; RUN: FileCheck %s --input-file %t -check-prefix=CHECK-MAX-CTX-DEPTH
9 ; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb]:48:0
10 ; CHECK-UNCOMPRESS: 1: 11
11 ; CHECK-UNCOMPRESS: 2: 1 fa:1
12 ; CHECK-UNCOMPRESS: 65532: 11
13 ; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa]:24:0
14 ; CHECK-UNCOMPRESS: 1: 1
15 ; CHECK-UNCOMPRESS: 2: 13 fb:11
16 ; CHECK-UNCOMPRESS: 65527: 1
17 ; CHECK-UNCOMPRESS:[main:1 @ foo]:7:0
18 ; CHECK-UNCOMPRESS: 2: 1
19 ; CHECK-UNCOMPRESS: 3: 2 fa:1
20 ; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa]:7:0
21 ; CHECK-UNCOMPRESS: 1: 1
22 ; CHECK-UNCOMPRESS: 2: 2 fb:1
23 ; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb]:2:0
24 ; CHECK-UNCOMPRESS: 2: 1 fa:1
25 ; CHECK-UNCOMPRESS: 65532: 1
26 ; CHECK-UNCOMPRESS:[main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb:2 @ fa]:2:0
27 ; CHECK-UNCOMPRESS: 4: 1
29 ; CHECK-MAX-CTX-DEPTH: [foo:3 @ fa:2 @ fb]:47:0
30 ; CHECK-MAX-CTX-DEPTH: 1: 11
31 ; CHECK-MAX-CTX-DEPTH: 65532: 11
32 ; CHECK-MAX-CTX-DEPTH: [main:1 @ foo:3 @ fa]:13:0
33 ; CHECK-MAX-CTX-DEPTH: 1: 1
34 ; CHECK-MAX-CTX-DEPTH: 2: 2
35 ; CHECK-MAX-CTX-DEPTH: 65527: 1
36 ; CHECK-MAX-CTX-DEPTH: [fa:2 @ fb:2 @ fa]:8:0
37 ; CHECK-MAX-CTX-DEPTH: 1: 1
38 ; CHECK-MAX-CTX-DEPTH: 2: 1
39 ; CHECK-MAX-CTX-DEPTH: 4: 1
40 ; CHECK-MAX-CTX-DEPTH: [main:1 @ foo]:7:0
41 ; CHECK-MAX-CTX-DEPTH: 2: 1
42 ; CHECK-MAX-CTX-DEPTH: 3: 2 fa:1
43 ; CHECK-MAX-CTX-DEPTH: [fb:2 @ fa:2 @ fb]:1:0
44 ; CHECK-MAX-CTX-DEPTH: 65532: 1
47 ;CHECK: [main:1 @ foo:3 @ fa:2 @ fb]:48:0
51 ;CHECK: [main:1 @ foo:3 @ fa]:24:0
55 ;CHECK: [main:1 @ foo:3 @ fa:2 @ fb:2 @ fa]:9:0
59 ;CHECK: [main:1 @ foo]:7:0
62 ;CHECK: [main:1 @ foo:3 @ fa:2 @ fb:2 @ fa:2 @ fb]:1:0
66 ; clang -O3 -g test.c -o a.out
70 if(n > 10) return fb(n / 2);
76 if(n % 2) return fb(n - 1);
84 printf("sum is %d\n", s);