; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --skip-symbolization --profile-summary-cold-count=0 --use-offset=0 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --skip-symbolization --profile-summary-cold-count=0 --use-offset=1 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER-OFFSET ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --skip-symbolization --profile-summary-cold-count=0 --use-offset=1 --use-first-loadable-segment-as-base=1 ; RUN: FileCheck %s --input-file %t --check-prefix=CHECK-UNWINDER-OFFSET2 ; RUN: llvm-profgen --format=text --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --profile-summary-cold-count=0 --csspgo-preinliner=0 --gen-cs-nested-profile=0 ; RUN: FileCheck %s --input-file %t ; CHECK: [main:2 @ foo]:74:0 ; CHECK-NEXT: 1: 0 ; CHECK-NEXT: 2: 15 ; CHECK-NEXT: 3: 15 ; CHECK-NEXT: 4: 14 ; CHECK-NEXT: 5: 1 ; CHECK-NEXT: 6: 15 ; CHECK-NEXT: 7: 0 ; CHECK-NEXT: 8: 14 bar:14 ; CHECK-NEXT: 9: 0 ; CHECK-NEXT: !CFGChecksum: 563088904013236 ; CHECK:[main:2 @ foo:8 @ bar]:28:14 ; CHECK-NEXT: 1: 14 ; CHECK-NEXT: 4: 14 ; CHECK-NEXT: !CFGChecksum: 72617220756 ; CHECK-UNWINDER: 3 ; CHECK-UNWINDER-NEXT: 201800-201858:1 ; CHECK-UNWINDER-NEXT: 20180e-20182b:1 ; CHECK-UNWINDER-NEXT: 20180e-201858:13 ; CHECK-UNWINDER-NEXT: 2 ; CHECK-UNWINDER-NEXT: 20182b->201800:1 ; CHECK-UNWINDER-NEXT: 201858->20180e:15 ; CHECK-UNWINDER-OFFSET: 3 ; CHECK-UNWINDER-OFFSET-NEXT: 800-858:1 ; CHECK-UNWINDER-OFFSET-NEXT: 80e-82b:1 ; CHECK-UNWINDER-OFFSET-NEXT: 80e-858:13 ; CHECK-UNWINDER-OFFSET-NEXT: 2 ; CHECK-UNWINDER-OFFSET-NEXT: 82b->800:1 ; CHECK-UNWINDER-OFFSET-NEXT: 858->80e:15 ; CHECK-UNWINDER-OFFSET2: 3 ; CHECK-UNWINDER-OFFSET2-NEXT: 1800-1858:1 ; CHECK-UNWINDER-OFFSET2-NEXT: 180e-182b:1 ; CHECK-UNWINDER-OFFSET2-NEXT: 180e-1858:13 ; CHECK-UNWINDER-OFFSET2-NEXT: 2 ; CHECK-UNWINDER-OFFSET2-NEXT: 182b->1800:1 ; CHECK-UNWINDER-OFFSET2-NEXT: 1858->180e:15 ; clang -O3 -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 #include <stdio.h> int bar(int x, int y) { if (x % 3) { return x - y; } return x + y; } void foo() { int s, i = 0; while (i++ < 4000 * 4000) if (i % 91) s = bar(i, s); else s += 30; printf("sum is %d\n", s); } int main() { foo(); return 0; }