mirror of
https://github.com/Gericom/teak-llvm.git
synced 2025-06-29 08:19:01 -04:00

intent when we added remark support, but was never implemented in the general case, because the first -R flags didn't need it. (-Rpass= had special handling to accomodate its argument.) -Rno-foo, -Reverything, and -Rno-everything can be used to turn off a remark, or to turn on or off all remarks. Per discussion on cfe-commits, -Weverything does not affect remarks, and -Reverything does not affect warnings or errors. The only "real" -R flag we have right now is -Rmodule-build; that flag is effectively renamed from -Wmodule-build to -Rmodule-build by this change. -Wpass and -Wno-pass (and their friends) are also renamed to -Rpass and -Rno-pass by this change; it's not completely clear whether we intended to have a -Rpass (with no =pattern), but that is unchanged by this commit, other than the flag name. The default pattern is effectively one which matches no passes. In future, we may want to make the default pattern be .*, so that -Reverything works for -Rpass properly. llvm-svn: 215046
52 lines
2.3 KiB
C
52 lines
2.3 KiB
C
// This file tests the -Rpass family of flags (-Rpass, -Rpass-missed
|
|
// and -Rpass-analysis) with the inliner. The test is designed to
|
|
// always trigger the inliner, so it should be independent of the
|
|
// optimization level.
|
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -emit-llvm-only -verify
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -emit-llvm-only -gline-tables-only -verify
|
|
// RUN: %clang_cc1 %s -Rpass=inline -emit-llvm -o - 2>/dev/null | FileCheck %s
|
|
//
|
|
// Check that we can override -Rpass= with -Rno-pass.
|
|
// RUN: %clang_cc1 %s -Rpass=inline -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rno-pass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rno-everything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
|
//
|
|
// FIXME: -Reverything should imply -Rpass=.*.
|
|
// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>/dev/null | FileCheck %s --check-prefix=CHECK-NO-REMARKS
|
|
//
|
|
// FIXME: -Rpass should either imply -Rpass=.* or should be rejected.
|
|
// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>/dev/null | FileCheck %s --check-prefix=CHECK-NO-REMARKS
|
|
|
|
// CHECK-REMARKS: remark:
|
|
// CHECK-NO-REMARKS-NOT: remark:
|
|
|
|
// -Rpass should produce source location annotations, exclusively (just
|
|
// like -gmlt).
|
|
// CHECK: , !dbg !
|
|
// CHECK-NOT: DW_TAG_base_type
|
|
|
|
// But llvm.dbg.cu should be missing (to prevent writing debug info to
|
|
// the final output).
|
|
// CHECK-NOT: !llvm.dbg.cu = !{
|
|
|
|
int foo(int x, int y) __attribute__((always_inline));
|
|
int foo(int x, int y) { return x + y; }
|
|
|
|
float foz(int x, int y) __attribute__((noinline));
|
|
float foz(int x, int y) { return x * y; }
|
|
|
|
// The negative diagnostics are emitted twice because the inliner runs
|
|
// twice.
|
|
//
|
|
int bar(int j) {
|
|
// expected-remark@+6 {{foz should never be inlined (cost=never)}}
|
|
// expected-remark@+5 {{foz will not be inlined into bar}}
|
|
// expected-remark@+4 {{foz should never be inlined}}
|
|
// expected-remark@+3 {{foz will not be inlined into bar}}
|
|
// expected-remark@+2 {{foo should always be inlined}}
|
|
// expected-remark@+1 {{foo inlined into bar}}
|
|
return foo(j, j - 2) * foz(j - 2, j);
|
|
}
|