1// RUN: %clang_pgogen -O2 -o %t %s
2// RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
3// RUN: llvm-profdata show -function main -counts %t.profraw| FileCheck %s
4
5void exit(int);
6int g;
7__attribute__((noinline)) void foo()
8{
9 g++;
10 if (g==1000)
11 exit(0);
12}
13
14
15int main()
16{
17 while (1) {
18 foo();
19 }
20
21}
22
23// CHECK: Counters:
24// CHECK-NEXT: main:
25// CHECK-NEXT: Hash: {{.*}}
26// CHECK-NEXT: Counters: 2
27// CHECK-NEXT: Block counts: [1000, 1]
28
29
30
31

source code of compiler-rt/test/profile/infinite_loop.c