1 // XFAIL: aix
2 // RUN: %clang_pgogen -mllvm -pgo-function-entry-coverage %s -o %t.out
3 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.out
4 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
5 // RUN: llvm-profdata show --covered %t.profdata | FileCheck %s --implicit-check-not goo
6 
7 // RUN: %clang_cspgogen -O1 -mllvm -pgo-function-entry-coverage %s -o %t.cs.out
8 // RUN: env LLVM_PROFILE_FILE=%t.csprofraw %run %t.cs.out
9 // RUN: llvm-profdata merge -o %t.csprofdata %t.csprofraw
10 // RUN: llvm-profdata show --covered %t.csprofdata --showcs | FileCheck %s --implicit-check-not goo
11 
markUsed(int a)12 void markUsed(int a) {
13   volatile int g;
14   g = a;
15 }
16 
foo(int i)17 __attribute__((noinline)) int foo(int i) { return 4 * i + 1; }
bar(int i)18 __attribute__((noinline)) int bar(int i) { return 4 * i + 2; }
goo(int i)19 __attribute__((noinline)) int goo(int i) { return 4 * i + 3; }
20 
main(int argc,char * argv[])21 int main(int argc, char *argv[]) {
22   markUsed(foo(5));
23   markUsed(argc ? bar(6) : goo(7));
24   return 0;
25 }
26 
27 // CHECK: main
28 // CHECK: foo
29 // CHECK: bar
30