ipa-inline.c (initial_insns, max_insns): Delete.

* ipa-inline.c (initial_insns, max_insns): Delete.
	(compute_max_insns): New function.
	(cgraph_decide_inlining_of_small_function): Use it; take minimal amount
	of insns as base for code growth.
	(cgraph_decide_inlining): Make initial_insns local; do not compute
	max_insns.
	* params.def (PARAM_INLINE_UNIT_GROWTH): Set to 60.
	* doc/invoke.texi (inline-unit-growth): Update docs.

From-SVN: r121144
This commit is contained in:
Jan Hubicka 2007-01-24 23:45:00 +01:00 committed by Jan Hubicka
parent 078b307321
commit b7c27d5169
4 changed files with 40 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2007-01-24 Jan Hubicka <jh@suse.cz>
* ipa-inline.c (initial_insns, max_insns): Delete.
(compute_max_insns): New function.
(cgraph_decide_inlining_of_small_function): Use it; take minimal amount
of insns as base for code growth.
(cgraph_decide_inlining): Make initial_insns local; do not compute
max_insns.
* params.def (PARAM_INLINE_UNIT_GROWTH): Set to 60.
* doc/invoke.texi (inline-unit-growth): Update docs.
2007-01-24 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.h (x86_cmpxchg16b): Remove const.

View File

@ -6096,7 +6096,7 @@ before applying @option{--param inline-unit-growth}. The default is 10000
@item inline-unit-growth
Specifies maximal overall growth of the compilation unit caused by inlining.
This parameter is ignored when @option{-funit-at-a-time} is not used.
The default value is 50 which limits unit growth to 1.5 times the original
The default value is 60 which limits unit growth to 1.6 times the original
size.
@item large-stack-frame

View File

@ -169,9 +169,7 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *, enum inlining_mode,
/* Statistics we collect about inlining algorithm. */
static int ncalls_inlined;
static int nfunctions_inlined;
static int initial_insns;
static int overall_insns;
static int max_insns;
static gcov_type max_count;
/* Estimate size of the function after inlining WHAT into TO. */
@ -753,6 +751,19 @@ cgraph_set_inline_failed (struct cgraph_node *node, const char *reason)
e->inline_failed = reason;
}
/* Given whole compilation unit esitmate of INSNS, compute how large we can
allow the unit to grow. */
static int
compute_max_insns (int insns)
{
int max_insns = insns;
if (max_insns < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
max_insns = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
return max_insns = ((HOST_WIDEST_INT) max_insns
* (100 + PARAM_VALUE (PARAM_INLINE_UNIT_GROWTH)) / 100);
}
/* We use greedy algorithm for inlining of small functions:
All inline candidates are put into prioritized heap based on estimated
growth of the overall number of instructions and then update the estimates.
@ -768,6 +779,7 @@ cgraph_decide_inlining_of_small_functions (void)
const char *failed_reason;
fibheap_t heap = fibheap_new ();
bitmap updated_nodes = BITMAP_ALLOC (NULL);
int min_insns, max_insns;
if (dump_file)
fprintf (dump_file, "\nDeciding on smaller functions:\n");
@ -796,6 +808,10 @@ cgraph_decide_inlining_of_small_functions (void)
edge->aux = fibheap_insert (heap, cgraph_edge_badness (edge), edge);
}
}
max_insns = compute_max_insns (overall_insns);
min_insns = overall_insns;
while (overall_insns <= max_insns && (edge = fibheap_extract_min (heap)))
{
int old_insns = overall_insns;
@ -923,6 +939,14 @@ cgraph_decide_inlining_of_small_functions (void)
edge->caller->global.insns,
overall_insns - old_insns);
}
if (min_insns > overall_insns)
{
min_insns = overall_insns;
max_insns = compute_max_insns (min_insns);
if (dump_file)
fprintf (dump_file, "New minimal insns reached: %i\n", min_insns);
}
}
while ((edge = fibheap_extract_min (heap)) != NULL)
{
@ -949,6 +973,7 @@ cgraph_decide_inlining (void)
XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
int old_insns = 0;
int i;
int initial_insns;
max_count = 0;
for (node = cgraph_nodes; node; node = node->next)
@ -965,13 +990,6 @@ cgraph_decide_inlining (void)
overall_insns = initial_insns;
gcc_assert (!max_count || (profile_info && flag_branch_probabilities));
max_insns = overall_insns;
if (max_insns < PARAM_VALUE (PARAM_LARGE_UNIT_INSNS))
max_insns = PARAM_VALUE (PARAM_LARGE_UNIT_INSNS);
max_insns = ((HOST_WIDEST_INT) max_insns
* (100 + PARAM_VALUE (PARAM_INLINE_UNIT_GROWTH)) / 100);
nnodes = cgraph_postorder (order);
if (dump_file)
@ -996,12 +1014,10 @@ cgraph_decide_inlining (void)
/* Handle nodes to be flattened, but don't update overall unit size. */
if (lookup_attribute ("flatten", DECL_ATTRIBUTES (node->decl)) != NULL)
{
int old_overall_insns = overall_insns;
if (dump_file)
fprintf (dump_file,
"Flattening %s\n", cgraph_node_name (node));
cgraph_decide_inlining_incrementally (node, INLINE_ALL, 0);
overall_insns = old_overall_insns;
}
if (!node->local.disregard_inline_limits)

View File

@ -199,7 +199,7 @@ DEFPARAM(PARAM_LARGE_UNIT_INSNS,
DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
"inline-unit-growth",
"how much can given compilation unit grow because of the inlining (in percent)",
50, 0, 0)
60, 0, 0)
DEFPARAM(PARAM_INLINE_CALL_COST,
"inline-call-cost",
"expense of call operation relative to ordinary arithmetic operations",