* 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
+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
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
-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
-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
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
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;
}
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))
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;
}
}
- 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);
}
/* 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)
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. */
if (optimize >= 2)
{
+ flag_inline_small_functions = 1;
flag_thread_jumps = 1;
flag_crossjumping = 1;
flag_optimize_sibling_calls = 1;
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;
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:
+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>
/* { 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
static void doubleindirect2(void)
{
doubleindirect();
+ do_something_usefull ();
}
static void doubleindirect1(void)
{
static void subcycle2(void)
{
subcycle1();
+ do_something_usefull ();
}
static void subcycle1(void)
{
static void doublesubcycle3(void)
{
doublesubcycle1();
+ do_something_usefull ();
}
static void doublesubcycle2(void)
{
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
int p;
int r;
+
+__attribute__ ((noinline))
int a(void)
{
return p;
{
}
VEC_edge_base;
-edge
+__attribute__ ((noinline)) edge
VEC_edge_base_index (const VEC_edge_base * vec_, unsigned ix_)
{
}
i.container = ev;
return i;
}
-ei_next (edge_iterator * i)
+__attribute__ ((noinline)) ei_next (edge_iterator * i)
{
}
static __inline__ edge
get_def_from_ptr (def_operand_p def)
{
}
-tree
+__attribute__ ((noinline)) tree
phi_nodes (basic_block bb)
{
}
{
return *mem;
}
+__attribute__ ((noinline))
int foo_read(volatile int *mem)
{
return inline_read(mem);
unsigned fib[1000];
+__attribute__ ((noinline))
void count_fib(void)
{
int i;
unsigned avg[1000];
+__attribute__ ((noinline))
void count_averages(int n)
{
int i;
long int fib[1000];
+__attribute__ ((noinline))
void count_fib(void)
{
int i;
int avg[1000];
+__attribute__ ((noinline))
void count_averages(void)
{
int i;
#include <stdlib.h>
#include "../../tree-vect.h"
+__attribute__ ((noinline))
void interp_pitch(float *exc, float *interp, int pitch, int len)
{
int i,k;