summaryrefslogtreecommitdiff
path: root/test/profile/infinite_loop.c
blob: 0e3981c712f6b12a92c6954e8ba7f80b41297eb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// RUN: %clang_pgogen  -O2 -o %t %s
// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
// RUN: llvm-profdata show -function main -counts  %t.profraw| FileCheck  %s 

void exit(int);
int g;
__attribute__((noinline)) void foo()
{
  g++;
  if (g==1000)
    exit(0);
}


int main()
{
  while (1) {
    foo();
  }

}

// CHECK: Counters:
// CHECK-NEXT:  main:
// CHECK-NEXT:    Hash: {{.*}}
// CHECK-NEXT:    Counters: 2
// CHECK-NEXT:    Block counts: [1000, 1]