mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-24 11:24:05 +08:00
re PR middle-end/29478 (optimization generates warning for casts)
* gcc.dg/tree-ssa/loadpre8.c: Disable inlining. * gcc.dg/tree-ssa/pr27236.c: Likewise. * gcc.dg/tree-ssa/predcom-1.c: Likewise. * gcc.dg/tree-ssa/predcom-2.c: Likewise. * gcc.dg/tree-ssa/flatten-2.c: Avoid overactive tail call ellim. * gcc.dg/tree-ssa/loadpre5.c: Likewise. * gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c: Likewise. * invoke.texi (-finline-small-functions): Document. * ipa-inline.c (cgraph_default_inline_p): Do not use DECL_INLINE when deciding what is inlinable. (cgraph_decide_recursive_inlining): Handle flag_inline_functions. (cgraph_decide_inlining_of_small_function): Handle new flags. (cgraph_decide_inlining_incrementally): Likewise. * opts.c (decode_options): Enable flag_inline_small_functions at -O2 * common.opt (finline-small-functions): New. * Makefile.in (build/gengtype.o-warn): Work around PR29478 From-SVN: r128092
This commit is contained in:
parent
4c5bae34c1
commit
4d4b8cb9c0
@ -1,3 +1,15 @@
|
||||
2007-09-04 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* invoke.texi (-finline-small-functions): Document.
|
||||
* ipa-inline.c (cgraph_default_inline_p): Do not use DECL_INLINE
|
||||
when deciding what is inlinable.
|
||||
(cgraph_decide_recursive_inlining): Handle flag_inline_functions.
|
||||
(cgraph_decide_inlining_of_small_function): Handle new flags.
|
||||
(cgraph_decide_inlining_incrementally): Likewise.
|
||||
* opts.c (decode_options): Enable flag_inline_small_functions at -O2
|
||||
* common.opt (finline-small-functions): New.
|
||||
* Makefile.in (build/gengtype.o-warn): Work around PR29478
|
||||
|
||||
2007-09-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* tree-ssa-operands.c (add_virtual_operand): Only mark
|
||||
|
@ -562,6 +562,10 @@ finline
|
||||
Common Report Var(flag_no_inline,0) Init(2)
|
||||
Pay attention to the \"inline\" keyword
|
||||
|
||||
finline-small-functions
|
||||
Common Report Var(flag_inline_small_functions) Optimization
|
||||
Integrate simple functions into their callers when code size is known to not growth
|
||||
|
||||
finline-functions
|
||||
Common Report Var(flag_inline_functions) Optimization
|
||||
Integrate simple functions into their callers
|
||||
|
@ -328,7 +328,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-fgcse -fgcse-lm -fgcse-sm -fgcse-las -fgcse-after-reload @gol
|
||||
-fcrossjumping -fif-conversion -fif-conversion2 @gol
|
||||
-finline-functions -finline-functions-called-once @gol
|
||||
-finline-limit=@var{n} -fkeep-inline-functions @gol
|
||||
-finline-small-functions -finline-limit=@var{n} -fkeep-inline-functions @gol
|
||||
-fkeep-static-consts -fmerge-constants -fmerge-all-constants @gol
|
||||
-fmodulo-sched -fmodulo-sched-allow-regmoves -fno-branch-count-reg @gol
|
||||
-fno-default-inline -fno-defer-pop -fmove-loop-invariants @gol
|
||||
@ -5033,6 +5033,7 @@ compilation time.
|
||||
-ftree-fre @gol
|
||||
-ftree-ch @gol
|
||||
-funit-at-a-time @gol
|
||||
-finline-small-functions @gol
|
||||
-fmerge-constants}
|
||||
|
||||
@option{-O} also turns on @option{-fomit-frame-pointer} on machines
|
||||
@ -5172,6 +5173,15 @@ Don't pay attention to the @code{inline} keyword. Normally this option
|
||||
is used to keep the compiler from expanding any functions inline.
|
||||
Note that if you are not optimizing, no functions can be expanded inline.
|
||||
|
||||
@item -finline-small-functions
|
||||
@opindex finline-small-functions
|
||||
Integrate functions into their callers when their body is smaller than expected
|
||||
function call code (so overall size of program gets smaller). The compiler
|
||||
heuristically decides which functions are simple enough to be worth integrating
|
||||
in this way.
|
||||
|
||||
Enabled at level @option{-O2}.
|
||||
|
||||
@item -finline-functions
|
||||
@opindex finline-functions
|
||||
Integrate all simple functions into their callers. The compiler
|
||||
|
@ -404,10 +404,10 @@ cgraph_default_inline_p (struct cgraph_node *n, const char **reason)
|
||||
|
||||
if (n->inline_decl)
|
||||
decl = n->inline_decl;
|
||||
if (!DECL_INLINE (decl))
|
||||
if (!flag_inline_small_functions && !DECL_DECLARED_INLINE_P (decl))
|
||||
{
|
||||
if (reason)
|
||||
*reason = N_("function not inlinable");
|
||||
*reason = N_("function not inline candidate");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -666,7 +666,8 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node)
|
||||
int depth = 0;
|
||||
int n = 0;
|
||||
|
||||
if (optimize_size)
|
||||
if (optimize_size
|
||||
|| (!flag_inline_functions && !DECL_DECLARED_INLINE_P (node->decl)))
|
||||
return false;
|
||||
|
||||
if (DECL_DECLARED_INLINE_P (node->decl))
|
||||
@ -863,6 +864,7 @@ cgraph_decide_inlining_of_small_functions (void)
|
||||
struct cgraph_node *where;
|
||||
int growth =
|
||||
cgraph_estimate_size_after_inlining (1, edge->caller, edge->callee);
|
||||
const char *not_good = NULL;
|
||||
|
||||
growth -= edge->caller->global.insns;
|
||||
|
||||
@ -916,13 +918,19 @@ cgraph_decide_inlining_of_small_functions (void)
|
||||
}
|
||||
}
|
||||
|
||||
if ((!cgraph_maybe_hot_edge_p (edge) || optimize_size) && growth > 0)
|
||||
if (!cgraph_maybe_hot_edge_p (edge))
|
||||
not_good = N_("call is unlikely and code size would grow");
|
||||
if (!flag_inline_functions
|
||||
&& !DECL_DECLARED_INLINE_P (edge->callee->decl))
|
||||
not_good = N_("function not declared inline and code size would grow");
|
||||
if (optimize_size)
|
||||
not_good = N_("optimizing for size and code size would grow");
|
||||
if (not_good && growth > 0)
|
||||
{
|
||||
if (!cgraph_recursive_inlining_p (edge->caller, edge->callee,
|
||||
&edge->inline_failed))
|
||||
{
|
||||
edge->inline_failed =
|
||||
N_("call is unlikely");
|
||||
edge->inline_failed = not_good;
|
||||
if (dump_file)
|
||||
fprintf (dump_file, " inline_failed:%s.\n", edge->inline_failed);
|
||||
}
|
||||
@ -1363,7 +1371,9 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
|
||||
/* When the function body would grow and inlining the function won't
|
||||
eliminate the need for offline copy of the function, don't inline.
|
||||
*/
|
||||
if (mode == INLINE_SIZE
|
||||
if ((mode == INLINE_SIZE
|
||||
|| (!flag_inline_functions
|
||||
&& !DECL_DECLARED_INLINE_P (e->callee->decl)))
|
||||
&& (cgraph_estimate_size_after_inlining (1, e->caller, e->callee)
|
||||
> e->caller->global.insns)
|
||||
&& cgraph_estimate_growth (e->callee) > 0)
|
||||
|
@ -353,6 +353,7 @@ static bool profile_arc_flag_set, flag_profile_values_set;
|
||||
static bool flag_unroll_loops_set, flag_tracer_set;
|
||||
static bool flag_value_profile_transformations_set;
|
||||
static bool flag_peel_loops_set, flag_branch_probabilities_set;
|
||||
static bool flag_inline_functions_set;
|
||||
|
||||
/* Functions excluded from profiling. */
|
||||
|
||||
@ -821,6 +822,7 @@ decode_options (unsigned int argc, const char **argv)
|
||||
|
||||
if (optimize >= 2)
|
||||
{
|
||||
flag_inline_small_functions = 1;
|
||||
flag_thread_jumps = 1;
|
||||
flag_crossjumping = 1;
|
||||
flag_optimize_sibling_calls = 1;
|
||||
@ -1605,6 +1607,10 @@ common_handle_option (size_t scode, const char *arg, int value,
|
||||
profile_arc_flag_set = true;
|
||||
break;
|
||||
|
||||
case OPT_finline_functions:
|
||||
flag_inline_functions_set = true;
|
||||
break;
|
||||
|
||||
case OPT_fprofile_use:
|
||||
if (!flag_branch_probabilities_set)
|
||||
flag_branch_probabilities = value;
|
||||
@ -1618,6 +1624,8 @@ common_handle_option (size_t scode, const char *arg, int value,
|
||||
flag_tracer = value;
|
||||
if (!flag_value_profile_transformations_set)
|
||||
flag_value_profile_transformations = value;
|
||||
if (!flag_inline_functions_set)
|
||||
flag_inline_functions = value;
|
||||
break;
|
||||
|
||||
case OPT_fprofile_generate:
|
||||
|
@ -1,3 +1,14 @@
|
||||
2007-09-04 Jan Hubicka <jh@suse.cz>
|
||||
|
||||
* gcc.dg/tree-ssa/loadpre8.c: Disable inlining.
|
||||
* gcc.dg/tree-ssa/pr27236.c: Likewise.
|
||||
* gcc.dg/tree-ssa/predcom-1.c: Likewise.
|
||||
* gcc.dg/tree-ssa/predcom-2.c: Likewise.
|
||||
* gcc.dg/tree-ssa/flatten-2.c: Avoid overactive tail call ellim.
|
||||
* gcc.dg/tree-ssa/loadpre5.c: Likewise.
|
||||
* gcc.dg/vect/costmodel/i386/costmodel-fast-math-vect-pr29925.c:
|
||||
Likewise.
|
||||
|
||||
2007-09-04 Janus Weil <jaydub66@gmail.com>
|
||||
Tobias Burnus <burnus@net-b.de>
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options -O2 } */
|
||||
|
||||
extern void do_something_usefull();
|
||||
/* Check that we finish compiling even if instructed to
|
||||
flatten a cyclic callgraph. Verify we correctly
|
||||
flatten with another function marked flatten in the
|
||||
@ -27,6 +28,7 @@ void __attribute__((flatten)) doubleindirect(void);
|
||||
static void doubleindirect2(void)
|
||||
{
|
||||
doubleindirect();
|
||||
do_something_usefull ();
|
||||
}
|
||||
static void doubleindirect1(void)
|
||||
{
|
||||
@ -42,6 +44,7 @@ static void subcycle1(void);
|
||||
static void subcycle2(void)
|
||||
{
|
||||
subcycle1();
|
||||
do_something_usefull ();
|
||||
}
|
||||
static void subcycle1(void)
|
||||
{
|
||||
@ -58,6 +61,7 @@ static void doublesubcycle2(void);
|
||||
static void doublesubcycle3(void)
|
||||
{
|
||||
doublesubcycle1();
|
||||
do_something_usefull ();
|
||||
}
|
||||
static void doublesubcycle2(void)
|
||||
{
|
||||
|
@ -2,6 +2,8 @@
|
||||
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
|
||||
int p;
|
||||
int r;
|
||||
|
||||
__attribute__ ((noinline))
|
||||
int a(void)
|
||||
{
|
||||
return p;
|
||||
|
@ -24,7 +24,7 @@ typedef struct VEC_edge_base
|
||||
{
|
||||
}
|
||||
VEC_edge_base;
|
||||
edge
|
||||
__attribute__ ((noinline)) edge
|
||||
VEC_edge_base_index (const VEC_edge_base * vec_, unsigned ix_)
|
||||
{
|
||||
}
|
||||
@ -56,7 +56,7 @@ ei_start_1 (VEC_edge_gc ** ev)
|
||||
i.container = ev;
|
||||
return i;
|
||||
}
|
||||
ei_next (edge_iterator * i)
|
||||
__attribute__ ((noinline)) ei_next (edge_iterator * i)
|
||||
{
|
||||
}
|
||||
static __inline__ edge
|
||||
@ -75,7 +75,7 @@ static __inline__ tree
|
||||
get_def_from_ptr (def_operand_p def)
|
||||
{
|
||||
}
|
||||
tree
|
||||
__attribute__ ((noinline)) tree
|
||||
phi_nodes (basic_block bb)
|
||||
{
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ static inline int inline_read(volatile int *mem)
|
||||
{
|
||||
return *mem;
|
||||
}
|
||||
__attribute__ ((noinline))
|
||||
int foo_read(volatile int *mem)
|
||||
{
|
||||
return inline_read(mem);
|
||||
|
@ -6,6 +6,7 @@ void abort (void);
|
||||
|
||||
unsigned fib[1000];
|
||||
|
||||
__attribute__ ((noinline))
|
||||
void count_fib(void)
|
||||
{
|
||||
int i;
|
||||
@ -18,6 +19,7 @@ void count_fib(void)
|
||||
|
||||
unsigned avg[1000];
|
||||
|
||||
__attribute__ ((noinline))
|
||||
void count_averages(int n)
|
||||
{
|
||||
int i;
|
||||
|
@ -6,6 +6,7 @@ void abort (void);
|
||||
|
||||
long int fib[1000];
|
||||
|
||||
__attribute__ ((noinline))
|
||||
void count_fib(void)
|
||||
{
|
||||
int i;
|
||||
@ -18,6 +19,7 @@ void count_fib(void)
|
||||
|
||||
int avg[1000];
|
||||
|
||||
__attribute__ ((noinline))
|
||||
void count_averages(void)
|
||||
{
|
||||
int i;
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <stdlib.h>
|
||||
#include "../../tree-vect.h"
|
||||
|
||||
__attribute__ ((noinline))
|
||||
void interp_pitch(float *exc, float *interp, int pitch, int len)
|
||||
{
|
||||
int i,k;
|
||||
|
Loading…
Reference in New Issue
Block a user