xref: /llvm-project/llvm/test/tools/llvm-profgen/inline-force-dwarf.test (revision d5a963ab8b40fcf7a99acd834e5f10a1a30cc2e5)
1; RUN: llvm-profgen --format=text --ignore-stack-samples --use-dwarf-correlation --perfscript=%S/Inputs/inline-cs-pseudoprobe.perfscript --binary=%S/Inputs/inline-cs-pseudoprobe.perfbin --output=%t --profile-summary-cold-count=0
2; RUN: FileCheck %s --input-file %t
3
4; CHECK:     main:1109:0
5; CHECK-NEXT: 0: 0
6; CHECK-NEXT: 2: 0
7; CHECK-NEXT: 1: foo:1109
8; CHECK-NEXT:  2: 14
9; CHECK-NEXT:  3: 15
10; CHECK-NEXT:  4: 0
11; CHECK-NEXT:  65525: 14
12; CHECK-NEXT:  3: bar:196
13; CHECK-NEXT:   1: 14
14
15
16; clang -O3 -fuse-ld=lld -fpseudo-probe-for-profiling
17; -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Xclang -mdisable-tail-calls
18; -g test.c  -o a.out
19
20#include <stdio.h>
21
22int bar(int x, int y) {
23  if (x % 3) {
24    return x - y;
25  }
26  return x + y;
27}
28
29void foo() {
30  int s, i = 0;
31  while (i++ < 4000 * 4000)
32    if (i % 91) s = bar(i, s); else s += 30;
33  printf("sum is %d\n", s);
34}
35
36int main() {
37  foo();
38  return 0;
39}
40