71 lines
2.1 KiB
Plaintext
71 lines
2.1 KiB
Plaintext
|
; Used the data from recursion-compression.test, refer it for the unmerged output
|
||
|
; RUN: llvm-profgen --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --compress-recursion=-1 --csprof-cold-thres=8
|
||
|
; RUN: FileCheck %s --input-file %t
|
||
|
|
||
|
; Test --csprof-keep-cold
|
||
|
; RUN: llvm-profgen --perfscript=%S/Inputs/recursion-compression-pseudoprobe.perfscript --binary=%S/Inputs/recursion-compression-pseudoprobe.perfbin --output=%t --compress-recursion=-1 --csprof-cold-thres=100 --csprof-keep-cold
|
||
|
; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-KEEP-COLD
|
||
|
|
||
|
; CHECK: [fa]:14:4
|
||
|
; CHECK-NEXT: 1: 4
|
||
|
; CHECK-NEXT: 3: 4
|
||
|
; CHECK-NEXT: 4: 2
|
||
|
; CHECK-NEXT: 5: 1
|
||
|
; CHECK-NEXT: 7: 2 fb:2
|
||
|
; CHECK-NEXT: 8: 1 fa:1
|
||
|
; CHECK-NEXT: !CFGChecksum: 120515930909
|
||
|
; CHECK-NEXT:[main:2 @ foo:5 @ fa:8 @ fa:7 @ fb:5 @ fb]:13:4
|
||
|
; CHECK-NEXT: 1: 4
|
||
|
; CHECK-NEXT: 2: 3
|
||
|
; CHECK-NEXT: 3: 1
|
||
|
; CHECK-NEXT: 5: 4 fb:4
|
||
|
; CHECK-NEXT: 6: 1 fa:1
|
||
|
; CHECK-NEXT: !CFGChecksum: 72617220756
|
||
|
|
||
|
; CHECK-KEEP-COLD: [fb]:19:6
|
||
|
; CHECK-KEEP-COLD-NEXT: 1: 6
|
||
|
; CHECK-KEEP-COLD-NEXT: 2: 3
|
||
|
; CHECK-KEEP-COLD-NEXT: 3: 3
|
||
|
; CHECK-KEEP-COLD-NEXT: 5: 4 fb:4
|
||
|
; CHECK-KEEP-COLD-NEXT: 6: 3 fa:3
|
||
|
; CHECK-KEEP-COLD-NEXT: !CFGChecksum: 72617220756
|
||
|
; CHECK-KEEP-COLD-NEXT:[fa]:14:4
|
||
|
; CHECK-KEEP-COLD-NEXT: 1: 4
|
||
|
; CHECK-KEEP-COLD-NEXT: 3: 4
|
||
|
; CHECK-KEEP-COLD-NEXT: 4: 2
|
||
|
; CHECK-KEEP-COLD-NEXT: 5: 1
|
||
|
; CHECK-KEEP-COLD-NEXT: 7: 2 fb:2
|
||
|
; CHECK-KEEP-COLD-NEXT: 8: 1 fa:1
|
||
|
; CHECK-KEEP-COLD-NEXT: !CFGChecksum: 120515930909
|
||
|
|
||
|
|
||
|
; clang -O3 -fexperimental-new-pass-manager -fuse-ld=lld -fpseudo-probe-for-profiling
|
||
|
; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls
|
||
|
; -g test.c -o a.out
|
||
|
|
||
|
; Copied from recursion-compression.test
|
||
|
#include <stdio.h>
|
||
|
|
||
|
int fb(int n) {
|
||
|
if(n > 10) return fb(n / 2);
|
||
|
return fa(n - 1);
|
||
|
}
|
||
|
|
||
|
int fa(int n) {
|
||
|
if(n < 2) return n;
|
||
|
if(n % 2) return fb(n - 1);
|
||
|
return fa(n - 1);
|
||
|
}
|
||
|
|
||
|
void foo() {
|
||
|
int s, i = 0;
|
||
|
while (i++ < 10000)
|
||
|
s += fa(i);
|
||
|
printf("sum is %d\n", s);
|
||
|
}
|
||
|
|
||
|
int main() {
|
||
|
foo();
|
||
|
return 0;
|
||
|
}
|