Files
clang-p2996/clang/test/CodeGen/profile-function-groups.c
Ellis Hoag af58684f27 [InstrProf] Add options to profile function groups
Add two options, `-fprofile-function-groups=N` and `-fprofile-selected-function-group=i` used to partition functions into `N` groups and only instrument the functions in group `i`. Similar options were added to xray in https://reviews.llvm.org/D87953 and the goal is the same; to reduce instrumented size overhead by spreading the overhead across multiple builds. Raw profiles from different groups can be added like normal using the `llvm-profdata merge` command.

Reviewed By: ianlevesque

Differential Revision: https://reviews.llvm.org/D129594
2022-07-14 11:41:30 -07:00

25 lines
879 B
C

// RUN: %clang -fprofile-generate -fprofile-function-groups=3 -fprofile-selected-function-group=0 -emit-llvm -S %s -o - | FileCheck %s --check-prefixes=CHECK,SELECT0
// RUN: %clang -fprofile-generate -fprofile-function-groups=3 -fprofile-selected-function-group=1 -emit-llvm -S %s -o - | FileCheck %s --check-prefixes=CHECK,SELECT1
// RUN: %clang -fprofile-generate -fprofile-function-groups=3 -fprofile-selected-function-group=2 -emit-llvm -S %s -o - | FileCheck %s --check-prefixes=CHECK,SELECT2
// Group 0
// SELECT0-NOT: noprofile
// SELECT1: noprofile
// SELECT2: noprofile
// CHECK: define {{.*}} @hoo()
void hoo() {}
// Group 1
// SELECT0: noprofile
// SELECT1-NOT: noprofile
// SELECT2: noprofile
// CHECK: define {{.*}} @goo()
void goo() {}
// Group 2
// SELECT0: noprofile
// SELECT1: noprofile
// SELECT2-NOT: noprofile
// CHECK: define {{.*}} @boo()
void boo() {}