2014-05-30 03:55:06 +08:00
|
|
|
// 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
|
2019-06-20 01:41:30 +08:00
|
|
|
// optimization level (under the legacy PM). The inliner is not added to the new
|
|
|
|
// PM pipeline unless optimizations are present.
|
2014-04-17 00:54:24 +08:00
|
|
|
|
2019-06-20 01:41:30 +08:00
|
|
|
// The inliner for the new PM does not seem to be enabled at O0, but we still
|
|
|
|
// get the same remarks with at least O1. The remarks are also slightly
|
|
|
|
// different and located in another test file.
|
2021-01-16 05:56:57 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -fno-experimental-new-pass-manager -emit-llvm-only -verify
|
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -fno-experimental-new-pass-manager -emit-llvm-only -debug-info-kind=line-tables-only -verify
|
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -emit-llvm -o - 2>/dev/null | FileCheck %s
|
Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
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
2014-08-07 08:24:21 +08:00
|
|
|
//
|
|
|
|
// Check that we can override -Rpass= with -Rno-pass.
|
2021-01-16 05:56:57 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
2021-09-29 05:42:23 +08:00
|
|
|
// 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
|
2021-01-16 05:56:57 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
2021-09-29 09:33:26 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass -Rno-pass -round-trip-args -fexperimental-new-pass-manager -mllvm -mandatory-inlining-first=false -O1 -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-NO-REMARKS
|
2019-06-20 01:41:30 +08:00
|
|
|
//
|
|
|
|
// The inliner for the new PM does not seem to be enabled at O0, but we still
|
|
|
|
// get the same remarks with at least O1.
|
2021-10-01 07:13:05 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -Rno-everything -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
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
2014-08-07 08:24:21 +08:00
|
|
|
//
|
2019-01-30 03:33:48 +08:00
|
|
|
// Check that -w doesn't disable remarks.
|
2021-01-16 05:56:57 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fno-experimental-new-pass-manager -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
2021-10-01 07:13:05 +08:00
|
|
|
// RUN: %clang_cc1 %s -Rpass=inline -fexperimental-new-pass-manager -O1 -w -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
2019-01-30 03:33:48 +08:00
|
|
|
//
|
2021-09-22 05:09:17 +08:00
|
|
|
// -Reverything implies -Rpass=.*.
|
|
|
|
// RUN: %clang_cc1 %s -Reverything -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
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
2014-08-07 08:24:21 +08:00
|
|
|
//
|
2021-09-22 05:09:17 +08:00
|
|
|
// -Rpass implies -Rpass=.*
|
|
|
|
// RUN: %clang_cc1 %s -Rpass -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=CHECK-REMARKS
|
Use -Rblah, not -Wblah, to control remark diagnostics. This was always the
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
2014-08-07 08:24:21 +08:00
|
|
|
|
|
|
|
// CHECK-REMARKS: remark:
|
|
|
|
// CHECK-NO-REMARKS-NOT: remark:
|
2014-06-25 01:02:17 +08:00
|
|
|
|
|
|
|
// -Rpass should produce source location annotations, exclusively (just
|
|
|
|
// like -gmlt).
|
|
|
|
// CHECK: , !dbg !
|
|
|
|
// CHECK-NOT: DW_TAG_base_type
|
|
|
|
|
2016-04-09 06:43:06 +08:00
|
|
|
// The CU should be marked NoDebug (to prevent writing debug info to
|
2014-06-25 01:02:17 +08:00
|
|
|
// the final output).
|
2016-04-09 06:43:06 +08:00
|
|
|
// CHECK: !llvm.dbg.cu = !{![[CU:.*]]}
|
|
|
|
// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}}emissionKind: NoDebug
|
2014-04-17 00:54:24 +08:00
|
|
|
|
|
|
|
int foo(int x, int y) __attribute__((always_inline));
|
|
|
|
int foo(int x, int y) { return x + y; }
|
|
|
|
|
2014-05-30 03:55:06 +08:00
|
|
|
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.
|
|
|
|
//
|
2014-06-06 06:11:12 +08:00
|
|
|
int bar(int j) {
|
2021-08-11 02:51:31 +08:00
|
|
|
// expected-remark@+3 {{'foz' not inlined into 'bar' because it should never be inlined (cost=never)}}
|
|
|
|
// expected-remark@+2 {{'foz' not inlined into 'bar' because it should never be inlined (cost=never)}}
|
|
|
|
// expected-remark@+1 {{'foo' inlined into 'bar'}}
|
2014-06-06 06:11:12 +08:00
|
|
|
return foo(j, j - 2) * foz(j - 2, j);
|
|
|
|
}
|