xref: /llvm-project/clang/test/CodeGen/use-sample-profile-attr.c (revision cb5a10199b32b5e1104ed36a490be73fa3bdf5ca)
1 // Test use-sample-profile attribute is present only when SampleFDO
2 // is enabled.
3 //
4 // RUN: %clang_cc1 -O2 \
5 // RUN:     -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -emit-llvm -o - \
6 // RUN:     2>&1 | FileCheck %s
7 // RUN: %clang_cc1 -O2 %s -emit-llvm -o - \
8 // RUN:     2>&1 | FileCheck %s --check-prefix=NOATTR
9 
10 // CHECK: define{{.*}} @func{{.*}} #[[ATTRID:[0-9]+]]
11 // CHECK: attributes #[[ATTRID]] = {{.*}} "use-sample-profile"
12 // NOATTR: define{{.*}} @func{{.*}} #[[ATTRID:[0-9]+]]
13 // NOATTR-NOT: attributes #[[ATTRID]] = {{.*}} "use-sample-profile"
14 
func(int a)15 int func(int a) { return a; }
16