mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 16:16:07 +00:00

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
30 lines
1.3 KiB
C
30 lines
1.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 -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) * foz(j - 2, j); }
|
|
|
|
// INLINE-NO-LOC: {{^remark: foo inlined into bar}}
|
|
// INLINE-NO-LOC: note: use -gline-tables-only -gcolumn-info to track
|