|
| 1 | +; Firstly test uncompression(--compress-recursion=0) |
| 2 | +; RUN: llvm-profgen --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --compress-recursion=0 |
| 3 | +; RUN: FileCheck %s --input-file %t -check-prefix=CHECK-UNCOMPRESS |
| 4 | +; RUN: llvm-profgen --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --show-unwinder-output | FileCheck %s --check-prefix=CHECK-UNWINDER |
| 5 | +; RUN: FileCheck %s --input-file %t |
| 6 | + |
| 7 | +; 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 |
| 8 | +; CHECK-UNCOMPRESS: 1: 1 |
| 9 | +; CHECK-UNCOMPRESS: 3: 1 |
| 10 | +; CHECK-UNCOMPRESS: 4: 1 |
| 11 | +; CHECK-UNCOMPRESS: 7: 1 fb:1 |
| 12 | +; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909 |
| 13 | +; 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 |
| 14 | +; CHECK-UNCOMPRESS: 1: 1 |
| 15 | +; CHECK-UNCOMPRESS: 3: 1 |
| 16 | +; CHECK-UNCOMPRESS: 4: 1 |
| 17 | +; CHECK-UNCOMPRESS: 7: 1 fb:1 |
| 18 | +; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909 |
| 19 | +; 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 |
| 20 | +; CHECK-UNCOMPRESS: 1: 1 |
| 21 | +; CHECK-UNCOMPRESS: 3: 1 |
| 22 | +; CHECK-UNCOMPRESS: 5: 1 |
| 23 | +; CHECK-UNCOMPRESS: 8: 1 fa:1 |
| 24 | +; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909 |
| 25 | +; 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 |
| 26 | +; CHECK-UNCOMPRESS: 1: 1 |
| 27 | +; CHECK-UNCOMPRESS: 3: 1 |
| 28 | +; CHECK-UNCOMPRESS: 6: 1 fa:1 |
| 29 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 30 | +; 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 |
| 31 | +; CHECK-UNCOMPRESS: 1: 1 |
| 32 | +; CHECK-UNCOMPRESS: 3: 1 |
| 33 | +; CHECK-UNCOMPRESS: 6: 1 fa:1 |
| 34 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 35 | +; 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 |
| 36 | +; CHECK-UNCOMPRESS: 1: 1 |
| 37 | +; CHECK-UNCOMPRESS: 3: 1 |
| 38 | +; CHECK-UNCOMPRESS: 6: 1 fa:1 |
| 39 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 40 | +; 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 |
| 41 | +; CHECK-UNCOMPRESS: 1: 1 |
| 42 | +; CHECK-UNCOMPRESS: 2: 1 |
| 43 | +; CHECK-UNCOMPRESS: 5: 1 fb:1 |
| 44 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 45 | +; 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 |
| 46 | +; CHECK-UNCOMPRESS: 1: 1 |
| 47 | +; CHECK-UNCOMPRESS: 2: 1 |
| 48 | +; CHECK-UNCOMPRESS: 5: 1 fb:1 |
| 49 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 50 | +; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:3:1 |
| 51 | +; CHECK-UNCOMPRESS: 1: 1 |
| 52 | +; CHECK-UNCOMPRESS: 2: 1 |
| 53 | +; CHECK-UNCOMPRESS: 5: 1 fb:1 |
| 54 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 55 | +; 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 |
| 56 | +; CHECK-UNCOMPRESS: 1: 1 |
| 57 | +; CHECK-UNCOMPRESS: 3: 1 |
| 58 | +; CHECK-UNCOMPRESS: !CFGChecksum: 120515930909 |
| 59 | +; CHECK-UNCOMPRESS: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:5 @ fb:5 @ fb:5 @ fb]:1:0 |
| 60 | +; CHECK-UNCOMPRESS: 5: 1 fb:1 |
| 61 | +; CHECK-UNCOMPRESS: !CFGChecksum: 72617220756 |
| 62 | + |
| 63 | + |
| 64 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb]:13:4 |
| 65 | +; CHECK: 1: 4 |
| 66 | +; CHECK: 2: 3 |
| 67 | +; CHECK: 3: 1 |
| 68 | +; CEHCK: 5: 4 fb:4 |
| 69 | +; CHECK: 6: 1 fa:1 |
| 70 | +; CHECK !CFGChecksum: 72617220756 |
| 71 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa]:6:2 |
| 72 | +; CHECK: 1: 2 |
| 73 | +; CHECK: 3: 2 |
| 74 | +; CHECK: 4: 1 |
| 75 | +; CHECK: 7: 1 fb:1 |
| 76 | +; CHECK: !CFGChecksum: 120515930909 |
| 77 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa]:4:1 |
| 78 | +; CHECK: 1: 1 |
| 79 | +; CHECK: 3: 1 |
| 80 | +; CHECK: 4: 1 |
| 81 | +; CHECK: 7: 1 fb:1 |
| 82 | +; CHECK: !CFGChecksum: 120515930909 |
| 83 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa]:4:1 |
| 84 | +; CHECK: 1: 1 |
| 85 | +; CHECK: 3: 1 |
| 86 | +; CHECK: 5: 1 |
| 87 | +; CHECK: 8: 1 fa:1 |
| 88 | +; CHECK: !CFGChecksum: 120515930909 |
| 89 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 @ fb]:3:1 |
| 90 | +; CHECK: 1: 1 |
| 91 | +; CHECK: 3: 1 |
| 92 | +; CHECK: 6: 1 fa:1 |
| 93 | +; CHECK: !CFGChecksum: 72617220756 |
| 94 | +; CHECK: [main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb]:3:1 |
| 95 | +; CHECK: 1: 1 |
| 96 | +; CHECK: 3: 1 |
| 97 | +; CHECK: 6: 1 fa:1 |
| 98 | +; CHECK: !CFGChecksum: 72617220756 |
| 99 | + |
| 100 | + |
| 101 | +; CHECK-UNWINDER: Binary(recursion-compression-pseudoprobe.perfbin)'s Range Counter: |
| 102 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 |
| 103 | +; CHECK-UNWINDER: (7a0, 7a7): 1 |
| 104 | +; CHECK-UNWINDER: (7a0, 7ab): 3 |
| 105 | +; CHECK-UNWINDER: (7b2, 7b5): 1 |
| 106 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 |
| 107 | +; CHECK-UNWINDER: (7c0, 7d4): 1 |
| 108 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 |
| 109 | +; CHECK-UNWINDER: (7c0, 7cd): 1 |
| 110 | +; CHECK-UNWINDER: (7db, 7e0): 1 |
| 111 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 |
| 112 | +; CHECK-UNWINDER: (7a0, 7a7): 1 |
| 113 | +; CHECK-UNWINDER: (7b2, 7b5): 1 |
| 114 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 |
| 115 | +; CHECK-UNWINDER: (7c0, 7cd): 2 |
| 116 | +; CHECK-UNWINDER: (7db, 7e0): 1 |
| 117 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 |
| 118 | +; CHECK-UNWINDER: (7a0, 7a7): 1 |
| 119 | +; CHECK-UNWINDER: (7b2, 7b5): 1 |
| 120 | + |
| 121 | +; CHECK-UNWINDER: Binary(recursion-compression-pseudoprobe.perfbin)'s Branch Counter: |
| 122 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 |
| 123 | +; CHECK-UNWINDER: (7a7, 7b2): 1 |
| 124 | +; CHECK-UNWINDER: (7ab, 7a0): 4 |
| 125 | +; CHECK-UNWINDER: (7b5, 7c0): 1 |
| 126 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 |
| 127 | +; CHECK-UNWINDER: (7d4, 7c0): 1 |
| 128 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 |
| 129 | +; CHECK-UNWINDER: (7cd, 7db): 1 |
| 130 | +; CHECK-UNWINDER: (7e0, 7a0): 1 |
| 131 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 |
| 132 | +; CHECK-UNWINDER: (7a7, 7b2): 1 |
| 133 | +; CHECK-UNWINDER: (7b5, 7c0): 1 |
| 134 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 |
| 135 | +; CHECK-UNWINDER: (7cd, 7db): 2 |
| 136 | +; CHECK-UNWINDER: (7e0, 7a0): 1 |
| 137 | +; CHECK-UNWINDER: main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb:6 @ fa:8 @ fa:7 @ fb:6 @ fa:7 |
| 138 | +; CHECK-UNWINDER: (7a7, 7b2): 1 |
| 139 | +; CHECK-UNWINDER: (7b5, 7c0): 1 |
| 140 | + |
| 141 | + |
| 142 | +; clang -O3 -fexperimental-new-pass-manager -fuse-ld=lld -fpseudo-probe-for-profiling |
| 143 | +; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls |
| 144 | +; -g test.c -o a.out |
| 145 | + |
| 146 | +#include <stdio.h> |
| 147 | + |
| 148 | +int fb(int n) { |
| 149 | + if(n > 10) return fb(n / 2); |
| 150 | + return fa(n - 1); |
| 151 | +} |
| 152 | + |
| 153 | +int fa(int n) { |
| 154 | + if(n < 2) return n; |
| 155 | + if(n % 2) return fb(n - 1); |
| 156 | + return fa(n - 1); |
| 157 | +} |
| 158 | + |
| 159 | +void foo() { |
| 160 | + int s, i = 0; |
| 161 | + while (i++ < 10000) |
| 162 | + s += fa(i); |
| 163 | + printf("sum is %d\n", s); |
| 164 | +} |
| 165 | + |
| 166 | +int main() { |
| 167 | + foo(); |
| 168 | + return 0; |
| 169 | +} |
0 commit comments