* 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
+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.
2007-01-24 Jakub Jelinek <jakub@redhat.com>
* config/i386/i386.h (x86_cmpxchg16b): Remove const.
@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.
@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
size.
@item large-stack-frame
/* Statistics we collect about inlining algorithm. */
static int ncalls_inlined;
static int nfunctions_inlined;
/* Statistics we collect about inlining algorithm. */
static int ncalls_inlined;
static int nfunctions_inlined;
-static int initial_insns;
static int overall_insns;
static int overall_insns;
static gcov_type max_count;
/* Estimate size of the function after inlining WHAT into TO. */
static gcov_type max_count;
/* Estimate size of the function after inlining WHAT into TO. */
e->inline_failed = 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.
/* 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.
const char *failed_reason;
fibheap_t heap = fibheap_new ();
bitmap updated_nodes = BITMAP_ALLOC (NULL);
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");
if (dump_file)
fprintf (dump_file, "\nDeciding on smaller functions:\n");
edge->aux = fibheap_insert (heap, cgraph_edge_badness (edge), edge);
}
}
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;
while (overall_insns <= max_insns && (edge = fibheap_extract_min (heap)))
{
int old_insns = overall_insns;
edge->caller->global.insns,
overall_insns - old_insns);
}
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)
{
}
while ((edge = fibheap_extract_min (heap)) != NULL)
{
XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
int old_insns = 0;
int i;
XCNEWVEC (struct cgraph_node *, cgraph_n_nodes);
int old_insns = 0;
int i;
max_count = 0;
for (node = cgraph_nodes; node; node = node->next)
max_count = 0;
for (node = cgraph_nodes; node; node = node->next)
overall_insns = initial_insns;
gcc_assert (!max_count || (profile_info && flag_branch_probabilities));
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)
nnodes = cgraph_postorder (order);
if (dump_file)
/* Handle nodes to be flattened, but don't update overall unit size. */
if (lookup_attribute ("flatten", DECL_ATTRIBUTES (node->decl)) != NULL)
{
/* 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);
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)
}
if (!node->local.disregard_inline_limits)
DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
"inline-unit-growth",
"how much can given compilation unit grow because of the inlining (in percent)",
DEFPARAM(PARAM_INLINE_UNIT_GROWTH,
"inline-unit-growth",
"how much can given compilation unit grow because of the inlining (in percent)",
DEFPARAM(PARAM_INLINE_CALL_COST,
"inline-call-cost",
"expense of call operation relative to ordinary arithmetic operations",
DEFPARAM(PARAM_INLINE_CALL_COST,
"inline-call-cost",
"expense of call operation relative to ordinary arithmetic operations",