Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / profile / instrprof-groups.c
blob1a56453da91413471731cd168e83dd5442c580a0
1 // RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=0 %s -o %t.0.out
2 // RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=1 %s -o %t.1.out
3 // RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=2 %s -o %t.2.out
4 // RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t.0.out
5 // RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t.1.out
6 // RUN: env LLVM_PROFILE_FILE=%t.2.profraw %run %t.2.out
7 // RUN: llvm-profdata merge -o %t.profdata %t.*.profraw
8 // RUN: llvm-profdata show %t.profdata --all-functions | FileCheck %s
10 int foo(int i) { return 4 * i + 1; }
11 int bar(int i) { return 4 * i + 2; }
12 int goo(int i) { return 4 * i + 3; }
14 int main(int argc, char *argv[]) {
15 foo(5);
16 bar(6);
17 goo(7);
18 return 0;
21 // Even though we ran this code three times, we expect all counts to be one if
22 // functions were partitioned into groups correctly.
24 // CHECK: Counters: 1
25 // CHECK: Counters: 1
26 // CHECK: Counters: 1
27 // CHECK: Counters: 1
28 // CHECK: Total functions: 4