xref: /llvm-project/clang/test/Frontend/remarks-hotness.cpp (revision f686e4bbc20a837ff5230656431aec1abbd5f872)
1 // Without hotness threshold, print both hot and cold remarks.
2 // RUN: %clang_cc1 -triple x86_64-linux %s -emit-llvm-only -O3 \
3 // RUN:     -fprofile-sample-use=%S/Inputs/remarks-hotness.prof \
4 // RUN:     -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline \
5 // RUN:     -fdiagnostics-show-hotness 2>&1 \
6 // RUN:     | FileCheck -check-prefix=REMARKS %s
7 
8 // With auto hotness threshold, only print hot remarks.
9 // RUN: %clang_cc1 -triple x86_64-linux %s -emit-llvm-only -O3 \
10 // RUN:     -fprofile-sample-use=%S/Inputs/remarks-hotness.prof \
11 // RUN:     -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline \
12 // RUN:     -fdiagnostics-show-hotness \
13 // RUN:     -fdiagnostics-hotness-threshold=auto 2>&1 \
14 // RUN:     | FileCheck -check-prefix=HOT_CALL %s
15 
16 // Make sure -fdiagnostics-hotness-threshold implies -fdiagnostics-show-hotness
17 // RUN: %clang_cc1 -triple x86_64-linux %s -emit-llvm-only -O3 \
18 // RUN:     -fprofile-sample-use=%S/Inputs/remarks-hotness.prof \
19 // RUN:     -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline \
20 // RUN:     -fdiagnostics-hotness-threshold=auto 2>&1 \
21 // RUN:     | FileCheck -check-prefix=HOT_CALL %s
22 
callee1()23 int callee1() {
24   return 1;
25 }
26 
callee2()27 __attribute__((noinline)) int callee2() {
28   return 2;
29 }
30 
31 // REMARKS: '_Z7callee1v' inlined into '_Z7caller1v'
32 // HOT_CALL: '_Z7callee1v' inlined into '_Z7caller1v'
caller1()33 int caller1() {
34   return callee1();
35 }
36 
37 // REMARKS: '_Z7callee2v' not inlined into '_Z7caller2v'
38 // HOT_CALL-NOT: '_Z7callee2v' not inlined into '_Z7caller2v'
caller2()39 int caller2() {
40   return callee2();
41 }
42