summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-19 05:55:20 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-08-19 05:55:20 +0000
commiteb7c606e1e1222b20023e10832593ae0e5478c8d (patch)
tree032d8e752b8a993f1aa19d59d320266d25238378 /gcc/ipa-inline.c
parentf260f060e739be598c8ff906ff61b6fdffe64571 (diff)
downloadgcc-eb7c606e1e1222b20023e10832593ae0e5478c8d.tar.gz
PR lto/45375
* ipa-inline.c (want_inline_small_function_p): Bypass inline limits for hinted functions. (edge_badness): Dump hints; decrease badness for hinted funcitons. * ipa-inline.h (enum inline_hints_vals): New enum. (inline_hints): New type. (edge_growth_cache_entry): Add hints. (dump_inline_summary): Update. (dump_inline_hints): Declare. (do_estimate_edge_hints): Declare. (estimate_edge_hints): New inline function. (reset_edge_growth_cache): Update. * predict.c (cgraph_maybe_hot_edge_p): Do not ice on indirect edges. * ipa-inline-analysis.c (dump_inline_hints): New function. (estimate_edge_devirt_benefit): Return true when function should be hinted. (estimate_calls_size_and_time): New hints argument; set it when devritualization happens. (estimate_node_size_and_time): New hints argument. (do_estimate_edge_time): Cache hints. (do_estimate_edge_growth): Update. (do_estimate_edge_hints): New function git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190509 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 5215049bc05..55d9a521c32 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -472,11 +472,15 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
else
{
int growth = estimate_edge_growth (e);
+ inline_hints hints = estimate_edge_hints (e);
if (growth <= 0)
;
+ /* Apply MAX_INLINE_INSNS_SINGLE limit. Do not do so when
+ hints suggests that inlining given function is very profitable. */
else if (DECL_DECLARED_INLINE_P (callee->symbol.decl)
- && growth >= MAX_INLINE_INSNS_SINGLE)
+ && growth >= MAX_INLINE_INSNS_SINGLE
+ && !(hints & INLINE_HINT_indirect_call))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_SINGLE_LIMIT;
want_inline = false;
@@ -523,8 +527,14 @@ want_inline_small_function_p (struct cgraph_edge *e, bool report)
e->inline_failed = CIF_NOT_DECLARED_INLINED;
want_inline = false;
}
+ /* Apply MAX_INLINE_INSNS_AUTO limit for functions not declared inline
+ Upgrade it to MAX_INLINE_INSNS_SINGLE when hints suggests that
+ inlining given function is very profitable. */
else if (!DECL_DECLARED_INLINE_P (callee->symbol.decl)
- && growth >= MAX_INLINE_INSNS_AUTO)
+ && growth >= ((hints & INLINE_HINT_indirect_call)
+ ? MAX (MAX_INLINE_INSNS_AUTO,
+ MAX_INLINE_INSNS_SINGLE)
+ : MAX_INLINE_INSNS_AUTO))
{
e->inline_failed = CIF_MAX_INLINE_INSNS_AUTO_LIMIT;
want_inline = false;
@@ -743,21 +753,25 @@ edge_badness (struct cgraph_edge *edge, bool dump)
struct cgraph_node *callee = cgraph_function_or_thunk_node (edge->callee,
NULL);
struct inline_summary *callee_info = inline_summary (callee);
+ inline_hints hints;
if (DECL_DISREGARD_INLINE_LIMITS (callee->symbol.decl))
return INT_MIN;
growth = estimate_edge_growth (edge);
time_growth = estimate_edge_time (edge);
+ hints = estimate_edge_hints (edge);
if (dump)
{
fprintf (dump_file, " Badness calculation for %s -> %s\n",
xstrdup (cgraph_node_name (edge->caller)),
xstrdup (cgraph_node_name (callee)));
- fprintf (dump_file, " size growth %i, time growth %i\n",
+ fprintf (dump_file, " size growth %i, time growth %i ",
growth,
time_growth);
+ dump_inline_hints (dump_file, hints);
+ fprintf (dump_file, "\n");
}
/* Always prefer inlining saving code size. */
@@ -849,6 +863,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
if (dump)
fprintf (dump_file, "Badness overflow\n");
}
+ if (hints & INLINE_HINT_indirect_call)
+ badness /= 8;
if (dump)
{
fprintf (dump_file,