aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 3df79a45f37..9fef33e9557 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -300,7 +300,9 @@ cgraph_assemble_pending_functions (void)
cgraph_nodes_queue = cgraph_nodes_queue->next_needed;
n->next_needed = NULL;
- if (!n->global.inlined_to && !DECL_EXTERNAL (n->decl))
+ if (!n->global.inlined_to
+ && !n->alias
+ && !DECL_EXTERNAL (n->decl))
{
cgraph_expand_function (n);
output = true;
@@ -356,8 +358,7 @@ cgraph_finalize_function (tree decl, bool nested)
cgraph_remove_node (n);
}
- while (node->callees)
- cgraph_remove_edge (node->callees);
+ cgraph_node_remove_callees (node);
/* We may need to re-queue the node for assembling in case
we already proceeded it and ignored as not needed. */
@@ -681,6 +682,8 @@ cgraph_finalize_compilation_unit (void)
{
struct cgraph_node *node;
+ finish_aliases_1 ();
+
if (!flag_unit_at_a_time)
{
cgraph_assemble_pending_functions ();
@@ -843,8 +846,7 @@ cgraph_expand_function (struct cgraph_node *node)
DECL_INITIAL (node->decl) = error_mark_node;
/* Eliminate all call edges. This is important so the call_expr no longer
points to the dead function body. */
- while (node->callees)
- cgraph_remove_edge (node->callees);
+ cgraph_node_remove_callees (node);
}
}
@@ -1006,8 +1008,7 @@ cgraph_remove_unreachable_nodes (void)
DECL_STRUCT_FUNCTION (node->decl) = NULL;
DECL_INITIAL (node->decl) = error_mark_node;
}
- while (node->callees)
- cgraph_remove_edge (node->callees);
+ cgraph_node_remove_callees (node);
node->analyzed = false;
}
else
@@ -1031,7 +1032,12 @@ static int
cgraph_estimate_size_after_inlining (int times, struct cgraph_node *to,
struct cgraph_node *what)
{
- return (what->global.insns - INSNS_PER_CALL) * times + to->global.insns;
+ tree fndecl = what->decl;
+ tree arg;
+ int call_insns = PARAM_VALUE (PARAM_INLINE_CALL_COST);
+ for (arg = DECL_ARGUMENTS (fndecl); arg; arg = TREE_CHAIN (arg))
+ call_insns += estimate_move_cost (TREE_TYPE (arg));
+ return (what->global.insns - call_insns) * times + to->global.insns;
}
/* Estimate the growth caused by inlining NODE into all callees. */
@@ -1125,7 +1131,8 @@ cgraph_mark_inline_edge (struct cgraph_edge *e)
to->global.insns = new_insns;
}
gcc_assert (what->global.inlined_to == to);
- overall_insns += new_insns - old_insns;
+ if (new_insns > old_insns)
+ overall_insns += new_insns - old_insns;
ncalls_inlined++;
}