[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Frontend / optimization-remark-new-pm.c
blobb40853c4ed660f2bdc3b88b0711b600a4d787d4e
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
7 int foo(int x, int y) __attribute__((always_inline));
8 int foo(int x, int y) { return x + y; }
10 float foz(int x, int y) __attribute__((noinline));
11 float foz(int x, int y) { return x * y; }
13 // The negative diagnostics are emitted twice because the inliner runs
14 // twice.
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);