optimization-remark-new-pm.c 1019 B

1234567891011121314151617181920
  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 doesnot 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 -fexperimental-new-pass-manager -emit-llvm-only -verify
  5. // RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O1 -fexperimental-new-pass-manager -emit-llvm-only -debug-info-kind=line-tables-only -verify
  6. int foo(int x, int y) __attribute__((always_inline));
  7. int foo(int x, int y) { return x + y; }
  8. float foz(int x, int y) __attribute__((noinline));
  9. float foz(int x, int y) { return x * y; }
  10. // The negative diagnostics are emitted twice because the inliner runs
  11. // twice.
  12. //
  13. int bar(int j) {
  14. // expected-remark@+2 {{foz not inlined into bar because it should never be inlined (cost=never)}}
  15. // expected-remark@+1 {{foo inlined into bar}}
  16. return foo(j, j - 2) * foz(j - 2, j);
  17. }