Commit 078c3644 by Jan Hubicka Committed by Jan Hubicka

tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare.

	* tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare.
	(estimate_move_cost): Assert that it does not get called for VOID_TYPE_P.
	(estimate_num_insns): Skip VOID types in argument handling.
	(optimize_inline_calls): Delete unreachable blocks and verify that
	callgraph is valid.

From-SVN: r147344
parent ea5783ee
2009-05-10 Jan Hubicka <jh@suse.cz> 2009-05-10 Jan Hubicka <jh@suse.cz>
* tree-inline.c (delete_unreachable_blocks_update_callgraph): Declare.
(estimate_move_cost): Assert that it does not get called for VOID_TYPE_P.
(estimate_num_insns): Skip VOID types in argument handling.
(optimize_inline_calls): Delete unreachable blocks and verify that
callgraph is valid.
2009-05-10 Jan Hubicka <jh@suse.cz>
* cgraphbuild.c (record_reference): Use cgraph_mark_address_taken_node. * cgraphbuild.c (record_reference): Use cgraph_mark_address_taken_node.
* cgraph.c (cgraph_mark_address_taken_node): New function. * cgraph.c (cgraph_mark_address_taken_node): New function.
(dump_cgraph_node): Dump new flag. (dump_cgraph_node): Dump new flag.
......
...@@ -132,6 +132,7 @@ static tree copy_decl_to_var (tree, copy_body_data *); ...@@ -132,6 +132,7 @@ static tree copy_decl_to_var (tree, copy_body_data *);
static tree copy_result_decl_to_var (tree, copy_body_data *); static tree copy_result_decl_to_var (tree, copy_body_data *);
static tree copy_decl_maybe_to_var (tree, copy_body_data *); static tree copy_decl_maybe_to_var (tree, copy_body_data *);
static gimple remap_gimple_stmt (gimple, copy_body_data *); static gimple remap_gimple_stmt (gimple, copy_body_data *);
static bool delete_unreachable_blocks_update_callgraph (copy_body_data *id);
/* Insert a tree->tree mapping for ID. Despite the name suggests /* Insert a tree->tree mapping for ID. Despite the name suggests
that the trees should be variables, it is used for more than that. */ that the trees should be variables, it is used for more than that. */
...@@ -2768,6 +2769,8 @@ estimate_move_cost (tree type) ...@@ -2768,6 +2769,8 @@ estimate_move_cost (tree type)
{ {
HOST_WIDE_INT size; HOST_WIDE_INT size;
gcc_assert (!VOID_TYPE_P (type));
size = int_size_in_bytes (type); size = int_size_in_bytes (type);
if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (!optimize_size)) if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (!optimize_size))
...@@ -3013,20 +3016,24 @@ estimate_num_insns (gimple stmt, eni_weights *weights) ...@@ -3013,20 +3016,24 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
{ {
tree arg; tree arg;
for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg)) for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
cost += estimate_move_cost (TREE_TYPE (arg)); if (!VOID_TYPE_P (TREE_TYPE (arg)))
cost += estimate_move_cost (TREE_TYPE (arg));
} }
else if (funtype && prototype_p (funtype)) else if (funtype && prototype_p (funtype))
{ {
tree t; tree t;
for (t = TYPE_ARG_TYPES (funtype); t; t = TREE_CHAIN (t)) for (t = TYPE_ARG_TYPES (funtype); t && t != void_list_node;
cost += estimate_move_cost (TREE_VALUE (t)); t = TREE_CHAIN (t))
if (!VOID_TYPE_P (TREE_VALUE (t)))
cost += estimate_move_cost (TREE_VALUE (t));
} }
else else
{ {
for (i = 0; i < gimple_call_num_args (stmt); i++) for (i = 0; i < gimple_call_num_args (stmt); i++)
{ {
tree arg = gimple_call_arg (stmt, i); tree arg = gimple_call_arg (stmt, i);
cost += estimate_move_cost (TREE_TYPE (arg)); if (!VOID_TYPE_P (TREE_TYPE (arg)))
cost += estimate_move_cost (TREE_TYPE (arg));
} }
} }
...@@ -3657,6 +3664,10 @@ optimize_inline_calls (tree fn) ...@@ -3657,6 +3664,10 @@ optimize_inline_calls (tree fn)
number_blocks (fn); number_blocks (fn);
fold_cond_expr_cond (); fold_cond_expr_cond ();
delete_unreachable_blocks_update_callgraph (&id);
#ifdef ENABLE_CHECKING
verify_cgraph_node (id.dst_node);
#endif
/* It would be nice to check SSA/CFG/statement consistency here, but it is /* It would be nice to check SSA/CFG/statement consistency here, but it is
not possible yet - the IPA passes might make various functions to not not possible yet - the IPA passes might make various functions to not
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment