/* Callgraph transformations to handle inlining
- Copyright (C) 2003, 2004, 2007, 2008, 2009, 2010, 2011
- Free Software Foundation, Inc.
+ Copyright (C) 2003-2013 Free Software Foundation, Inc.
Contributed by Jan Hubicka
This file is part of GCC.
those only after all devirtualizable virtual calls are processed.
Lacking may edges in callgraph we just preserve them post
inlining. */
- && (!DECL_VIRTUAL_P (node->symbol.decl)
- || (!DECL_COMDAT (node->symbol.decl)
- && !DECL_EXTERNAL (node->symbol.decl)))
+ && !DECL_VIRTUAL_P (node->symbol.decl)
/* During early inlining some unanalyzed cgraph nodes might be in the
callgraph and they might reffer the function in question. */
&& !cgraph_new_nodes);
cgraph_remove_unreachable_functions gets rid of them. */
gcc_assert (!e->callee->global.inlined_to);
symtab_dissolve_same_comdat_group_list ((symtab_node) e->callee);
- if (e->callee->analyzed && !DECL_EXTERNAL (e->callee->symbol.decl))
+ if (e->callee->symbol.definition && !DECL_EXTERNAL (e->callee->symbol.decl))
{
if (overall_size)
*overall_size -= inline_summary (e->callee)->size;
struct cgraph_node *n;
n = cgraph_clone_node (e->callee, e->callee->symbol.decl,
e->count, e->frequency,
- update_original, NULL, true);
+ update_original, vNULL, true);
cgraph_redirect_edge_callee (e, n);
}
}
bool
inline_call (struct cgraph_edge *e, bool update_original,
- VEC (cgraph_edge_p, heap) **new_edges,
+ vec<cgraph_edge_p> *new_edges,
int *overall_size, bool update_overall_summary)
{
int old_size = 0, new_size = 0;
if (!alias->callers
&& can_remove_node_now_p (alias, e))
{
- next_alias = cgraph_alias_aliased_node (alias);
+ next_alias = cgraph_alias_target (alias);
cgraph_remove_node (alias);
alias = next_alias;
}
if (update_overall_summary)
inline_update_overall_summary (to);
new_size = inline_summary (to)->size;
+
#ifdef ENABLE_CHECKING
/* Verify that estimated growth match real growth. Allow off-by-one
error due to INLINE_SIZE_SCALE roudoff errors. */
- gcc_assert (!update_overall_summary || !overall_size
+ gcc_assert (!update_overall_summary || !overall_size || new_edges_found
|| abs (estimated_growth - (new_size - old_size)) <= 1
/* FIXME: a hack. Edges with false predicate are accounted
wrong, we should remove them from callgraph. */
|| predicated);
#endif
-
- if (overall_size)
+
+ /* Account the change of overall unit size; external functions will be
+ removed and are thus not accounted. */
+ if (overall_size
+ && !DECL_EXTERNAL (to->symbol.decl))
*overall_size += new_size - old_size;
ncalls_inlined++;
/* Copy the OLD_VERSION_NODE function tree to the new version. */
tree_function_versioning (node->symbol.decl, first_clone->symbol.decl,
- NULL, true, NULL, false, NULL, NULL);
+ NULL, true, NULL, false,
+ NULL, NULL);
/* The function will be short lived and removed after we inline all the clones,
but make it internal so we won't confuse ourself. */
DECL_COMDAT_GROUP (first_clone->symbol.decl) = NULL_TREE;
TREE_PUBLIC (first_clone->symbol.decl) = 0;
DECL_COMDAT (first_clone->symbol.decl) = 0;
- VEC_free (ipa_opt_pass, heap,
- first_clone->ipa_transforms_to_apply);
- first_clone->ipa_transforms_to_apply = NULL;
+ first_clone->ipa_transforms_to_apply.release ();
/* When doing recursive inlining, the clone may become unnecessary.
This is possible i.e. in the case when the recursive function is proved to be
preserve_function_body_p (struct cgraph_node *node)
{
gcc_assert (cgraph_global_info_ready);
- gcc_assert (!node->alias && !node->thunk.thunk_p);
+ gcc_assert (!node->symbol.alias && !node->thunk.thunk_p);
/* Look if there is any clone around. */
if (node->clones)