xref: /llvm-project/compiler-rt/test/profile/infinite_loop.c (revision af8205d0eb47b416b6865488056797f4162321e4)
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 
5 void exit(int);
6 int g;
foo()7 __attribute__((noinline)) void foo()
8 {
9   g++;
10   if (g==1000)
11     exit(0);
12 }
13 
14 
main()15 int 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