[gcc(refs/users/hubicka/heads/honza-gcc-benchmark-branch-v2)] Limit inlining functions called once
Jan Hubicka
hubicka@gcc.gnu.org
Sat Dec 4 16:58:53 GMT 2021
https://gcc.gnu.org/g:e7df46723ccfa40f68ce84b8813e4e85cce3baa3
commit e7df46723ccfa40f68ce84b8813e4e85cce3baa3
Author: Jan Hubicka <jh@suse.cz>
Date: Sat Dec 4 17:58:14 2021 +0100
Limit inlining functions called once
Diff:
---
gcc/ipa-inline.c | 47 ++++++++++++++++++++++++++++++-----------------
1 file changed, 30 insertions(+), 17 deletions(-)
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 012b326b5e9..54cd085a84d 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -1091,20 +1091,30 @@ static bool
check_callers (struct cgraph_node *node, void *has_hot_call)
{
struct cgraph_edge *e;
- for (e = node->callers; e; e = e->next_caller)
- {
- if (!opt_for_fn (e->caller->decl, flag_inline_functions_called_once)
- || !opt_for_fn (e->caller->decl, optimize))
- return true;
- if (!can_inline_edge_p (e, true))
- return true;
- if (e->recursive_p ())
- return true;
- if (!can_inline_edge_by_limits_p (e, true))
- return true;
- if (!(*(bool *)has_hot_call) && e->maybe_hot_p ())
- *(bool *)has_hot_call = true;
- }
+ for (e = node->callers; e; e = e->next_caller)
+ {
+ if (!opt_for_fn (e->caller->decl, flag_inline_functions_called_once)
+ || !opt_for_fn (e->caller->decl, optimize))
+ return true;
+ if (!can_inline_edge_p (e, true))
+ return true;
+ if (e->recursive_p ())
+ return true;
+ if (!can_inline_edge_by_limits_p (e, true))
+ return true;
+ /* Inlining large functions to large loop depth is often harmful because
+ of register pressure it implies. */
+ if ((int)ipa_call_summaries->get (e)->loop_depth
+ > param_inline_functions_called_once_loop_depth)
+ return true;
+ /* Do not produce gigantic functions. */
+ if (estimate_size_after_inlining (e->caller->inlined_to ?
+ e->caller->inlined_to : e->caller, e)
+ > param_inline_functions_called_once_insns)
+ return true;
+ if (!(*(bool *)has_hot_call) && e->maybe_hot_p ())
+ *(bool *)has_hot_call = true;
+ }
return false;
}
@@ -1327,9 +1337,12 @@ edge_badness (struct cgraph_edge *edge, bool dump)
" %i (compensated)\n",
badness.to_double (),
freq.to_double (),
- edge->count.ipa ().initialized_p () ? edge->count.ipa ().to_gcov_type () : -1,
- caller->count.ipa ().initialized_p () ? caller->count.ipa ().to_gcov_type () : -1,
- inlining_speedup (edge, freq, unspec_edge_time, edge_time).to_double (),
+ edge->count.ipa ().initialized_p ()
+ ? edge->count.ipa ().to_gcov_type () : -1,
+ caller->count.ipa ().initialized_p ()
+ ? caller->count.ipa ().to_gcov_type () : -1,
+ inlining_speedup (edge, freq, unspec_edge_time,
+ edge_time).to_double (),
estimate_growth (callee),
callee_info->growth, overall_growth);
}
More information about the Gcc-cvs
mailing list