1 // RUN: llvm-profdata merge \
2 // RUN: %S/Inputs/optimization-remark-with-hotness.proftext \
4 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
5 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
6 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
7 // RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -verify
8 // The clang version of the previous test.
9 // RUN: %clang -target x86_64-apple-macosx10.9 %s -c -emit-llvm -o /dev/null \
10 // RUN: -fprofile-instr-use=%t.profdata -Rpass=inline \
11 // RUN: -Rpass-analysis=inline -fdiagnostics-show-hotness -Xclang -verify
12 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
13 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
14 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
15 // RUN: -Rpass-analysis=inline 2>&1 | FileCheck -check-prefix=HOTNESS_OFF %s
16 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
17 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
18 // RUN: -fprofile-instrument-use-path=%t.profdata -Rpass=inline \
19 // RUN: -Rpass-analysis=inline -Rno-pass-with-hotness 2>&1 | FileCheck \
20 // RUN: -check-prefix=HOTNESS_OFF %s
21 // RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -main-file-name \
22 // RUN: optimization-remark-with-hotness.c %s -emit-llvm-only \
23 // RUN: -Rpass=inline -Rpass-analysis=inline -fdiagnostics-show-hotness 2>&1 \
24 // RUN: | FileCheck -check-prefix=NO_PGO %s
26 int foo(int x, int y) __attribute__((always_inline));
27 int foo(int x, int y) { return x + y; }
32 // HOTNESS_OFF: foo inlined into bar
33 // HOTNESS_OFF-NOT: hotness:
34 // NO_PGO: '-fdiagnostics-show-hotness' requires profile-guided optimization information
35 // expected-remark@+2 {{foo should always be inlined (cost=always) (hotness: 30)}}
36 // expected-remark@+1 {{foo inlined into bar (hotness: 30)}}
40 int main(int argc, const char *argv[]) {
41 for (int i = 0; i < 30; i++)
42 // expected-remark@+1 {{bar should never be inlined}}