diff options
author | Jan Hubicka <jh@suse.cz> | 2012-08-19 07:55:20 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2012-08-19 05:55:20 +0000 |
commit | 37678631a8a4464bc16c8d02dfaa4086f6038cb1 (patch) | |
tree | 032d8e752b8a993f1aa19d59d320266d25238378 /gcc/ipa-inline.c | |
parent | ecfdae6f116a6c154d57a4fced789d6f1b396c07 (diff) | |
download | gcc-37678631a8a4464bc16c8d02dfaa4086f6038cb1.zip gcc-37678631a8a4464bc16c8d02dfaa4086f6038cb1.tar.gz gcc-37678631a8a4464bc16c8d02dfaa4086f6038cb1.tar.bz2 |
re PR lto/45375 ([meta-bug] Issues with building Mozilla (i.e. Firefox) with LTO)
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
From-SVN: r190509
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 5215049..55d9a52 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, |