| 1 |
// Verify that remarks for the inliner appear. The remarks under the new PM will |
| 2 |
// be slightly different than those emitted by the legacy PM. The new PM inliner |
| 3 |
// also does not appear to be added at O0, so we test at O1. |
| 4 |
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O1 -emit-llvm-only -verify |
| 5 |
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O1 -emit-llvm-only -debug-info-kind=line-tables-only -verify |
| 6 |
|
| 7 |
int foo(int x, int y) __attribute__((always_inline)); |
| 8 |
int foo(int x, int y) { return x + y; } |
| 9 |
|
| 10 |
float foz(int x, int y) __attribute__((noinline)); |
| 11 |
float foz(int x, int y) { return x * y; } |
| 12 |
|
| 13 |
// The negative diagnostics are emitted twice because the inliner runs |
| 14 |
// twice. |
| 15 |
// |
| 16 |
int bar(int j) { |
| 17 |
// expected-remark@+2 {{'foz' not inlined into 'bar' because it should never be inlined (cost=never)}} |
| 18 |
// expected-remark@+1 {{'foo' inlined into 'bar'}} |
| 19 |
return foo(j, j - 2) * foz(j - 2, j); |
| 20 |
} |