+2013-09-13 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/58094
+ * ipa-inline.c (check_callers): New function.
+ (check_caller_edge): Remove.
+ (want_inline_function_to_all_callers_p): Also permit alises that are
+ called dirrectly.
+ (inline_to_all_callers): Terminate the walk when devirtualization
+ introduce new calls.
+
2013-09-13 Jan Hubicka <jh@suse.cz>
* ipa-inline-analysis.c (struct growth_data): Add node.
return want_inline;
}
-/* Return true when NODE has caller other than EDGE.
+/* Return true when NODE has uninlinable caller;
+ set HAS_HOT_CALL if it has hot call.
Worker for cgraph_for_node_and_aliases. */
static bool
-check_caller_edge (struct cgraph_node *node, void *edge)
+check_callers (struct cgraph_node *node, void *has_hot_call)
{
- return (node->callers
- && node->callers != edge);
+ struct cgraph_edge *e;
+ for (e = node->callers; e; e = e->next_caller)
+ {
+ if (!can_inline_edge_p (e, true))
+ return true;
+ if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
+ *(bool *)has_hot_call = true;
+ }
+ return false;
}
/* If NODE has a caller, return true. */
want_inline_function_to_all_callers_p (struct cgraph_node *node, bool cold)
{
struct cgraph_node *function = cgraph_function_or_thunk_node (node, NULL);
- struct cgraph_edge *e;
bool has_hot_call = false;
/* Does it have callers? */
/* Inlining into all callers would increase size? */
if (estimate_growth (node) > 0)
return false;
- /* Maybe other aliases has more direct calls. */
- if (cgraph_for_node_and_aliases (node, check_caller_edge, node->callers, true))
- return false;
/* All inlines must be possible. */
- for (e = node->callers; e; e = e->next_caller)
- {
- if (!can_inline_edge_p (e, true))
- return false;
- if (!has_hot_call && cgraph_maybe_hot_edge_p (e))
- has_hot_call = 1;
- }
-
+ if (cgraph_for_node_and_aliases (node, check_callers, &has_hot_call, true))
+ return false;
if (!cold && !has_hot_call)
return false;
return true;
{
if (dump_file)
fprintf (dump_file, "New calls found; giving up.\n");
- break;
+ return true;
}
}
return false;