29 lines · c
1// RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=0 %s -o %t.0.out2// RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=1 %s -o %t.1.out3// RUN: %clang_pgogen -fprofile-function-groups=3 -fprofile-selected-function-group=2 %s -o %t.2.out4// RUN: env LLVM_PROFILE_FILE=%t.0.profraw %run %t.0.out5// RUN: env LLVM_PROFILE_FILE=%t.1.profraw %run %t.1.out6// RUN: env LLVM_PROFILE_FILE=%t.2.profraw %run %t.2.out7// RUN: llvm-profdata merge -o %t.profdata %t.*.profraw8// RUN: llvm-profdata show %t.profdata --all-functions | FileCheck %s9 10int foo(int i) { return 4 * i + 1; }11int bar(int i) { return 4 * i + 2; }12int goo(int i) { return 4 * i + 3; }13 14int main(int argc, char *argv[]) {15 foo(5);16 bar(6);17 goo(7);18 return 0;19}20 21// Even though we ran this code three times, we expect all counts to be one if22// functions were partitioned into groups correctly.23 24// CHECK: Counters: 125// CHECK: Counters: 126// CHECK: Counters: 127// CHECK: Counters: 128// CHECK: Total functions: 429