diff options
author | Diego Novillo <dnovillo@google.com> | 2014-05-29 19:55:06 +0000 |
---|---|---|
committer | Diego Novillo <dnovillo@google.com> | 2014-05-29 19:55:06 +0000 |
commit | d23ec94393bf2d0af4b5c6f94458f1d796eb928b (patch) | |
tree | b39af4eb6dfd4e0be3554492956698f7c8e567c7 /clang/test/Frontend/optimization-remark.c | |
parent | 20daf3276d1a32701ed7b5da9b6c3af49af5f7e1 (diff) | |
download | bcm5719-llvm-d23ec94393bf2d0af4b5c6f94458f1d796eb928b.tar.gz bcm5719-llvm-d23ec94393bf2d0af4b5c6f94458f1d796eb928b.zip |
Add flags -Rpass-missed and -Rpass-analysis.
Summary:
These two flags are in the same family as -Rpass, but are used in
different situations.
-Rpass-missed is used by optimizers to inform the user when they tried
to apply an optimization but couldn't (or wouldn't).
-Rpass-analysis is used by optimizers to report analysis results back
to the user (e.g., why the transformation could not be applied).
Depends on D3682.
Reviewers: rsmith
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D3683
llvm-svn: 209839
Diffstat (limited to 'clang/test/Frontend/optimization-remark.c')
-rw-r--r-- | clang/test/Frontend/optimization-remark.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/clang/test/Frontend/optimization-remark.c b/clang/test/Frontend/optimization-remark.c index 3a62db0db02..c36a9d42928 100644 --- a/clang/test/Frontend/optimization-remark.c +++ b/clang/test/Frontend/optimization-remark.c @@ -1,18 +1,29 @@ -// This file tests the -Rpass= flag with the inliner. The test is -// designed to always trigger the inliner, so it should be independent -// of the optimization level. +// 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 -O0 -gline-tables-only -emit-obj -verify -S -o /dev/null 2> %t.err +// RUN: %clang_cc1 %s -Rpass=inline -Rpass-analysis=inline -Rpass-missed=inline -O0 -gline-tables-only -emit-obj -verify -S -o /dev/null 2> %t.err // RUN: %clang -c %s -Rpass=inline -O0 -S -o /dev/null 2> %t.err // RUN: FileCheck < %t.err %s --check-prefix=INLINE-NO-LOC 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. +// +// 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}} -int bar(int j) { return foo(j, j - 2); } +int bar(int j) { return foo(j, j - 2) * foz(j - 2, j); } // INLINE-NO-LOC: {{^remark: foo inlined into bar}} // INLINE-NO-LOC: note: use -gline-tables-only -gcolumn-info to track |