1 // Test use-sample-profile attribute is present only when SampleFDO
2 // is enabled.
3 //
4 // RUN: %clang_cc1 -O2 -fno-experimental-new-pass-manager \
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 -fexperimental-new-pass-manager \
8 // RUN:     -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -emit-llvm -o - \
9 // RUN:     2>&1 | FileCheck %s
10 // RUN: %clang_cc1 -O2 -fno-experimental-new-pass-manager %s \
11 // RUN:     -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=NOATTR
12 // RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager %s -emit-llvm -o - \
13 // RUN:     2>&1 | FileCheck %s --check-prefix=NOATTR
14 
15 // CHECK: define{{.*}} @func{{.*}} #[[ATTRID:[0-9]+]]
16 // CHECK: attributes #[[ATTRID]] = {{.*}} "use-sample-profile"
17 // NOATTR: define{{.*}} @func{{.*}} #[[ATTRID:[0-9]+]]
18 // NOATTR-NOT: attributes #[[ATTRID]] = {{.*}} "use-sample-profile"
19 
20 int func(int a) { return a; }
21