Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / profile / instrprof-entry-coverage.c
blob99ec38b3e2a6c9379e6dda656fb3f29cc66d8d6e
1 // RUN: %clang_pgogen -mllvm -pgo-function-entry-coverage %s -o %t.out
2 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t.out
3 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
4 // RUN: llvm-profdata show --covered %t.profdata | FileCheck %s --implicit-check-not goo
6 // RUN: %clang_cspgogen -O1 -mllvm -pgo-function-entry-coverage %s -o %t.cs.out
7 // RUN: env LLVM_PROFILE_FILE=%t.csprofraw %run %t.cs.out
8 // RUN: llvm-profdata merge -o %t.csprofdata %t.csprofraw
9 // RUN: llvm-profdata show --covered %t.csprofdata --showcs | FileCheck %s --implicit-check-not goo
11 void markUsed(int a) {
12 volatile int g;
13 g = a;
16 __attribute__((noinline)) int foo(int i) { return 4 * i + 1; }
17 __attribute__((noinline)) int bar(int i) { return 4 * i + 2; }
18 __attribute__((noinline)) int goo(int i) { return 4 * i + 3; }
20 int main(int argc, char *argv[]) {
21 markUsed(foo(5));
22 markUsed(argc ? bar(6) : goo(7));
23 return 0;
26 // CHECK-DAG: main
27 // CHECK-DAG: foo
28 // CHECK-DAG: bar