Commit 613f61fc by Jan Hubicka Committed by Jan Hubicka

tree-inline.c (estimate_num_insns): For stdarg functions look into call…

tree-inline.c (estimate_num_insns): For stdarg functions look into call statement to count cost of argument passing.

	* tree-inline.c (estimate_num_insns): For stdarg functions look
	into call statement to count cost of argument passing.

From-SVN: r160094
parent 42ad7bc8
2010-06-01 Jan Hubicka <jh@suse.cz>
* tree-inline.c (estimate_num_insns): For stdarg functions look
into call statement to count cost of argument passing.
2010-06-01 Kai Tietz 2010-06-01 Kai Tietz
* config/i386.c (ix86_output_addr_vec_elt): Make LPREFIX * config/i386.c (ix86_output_addr_vec_elt): Make LPREFIX
......
...@@ -3367,6 +3367,7 @@ estimate_num_insns (gimple stmt, eni_weights *weights) ...@@ -3367,6 +3367,7 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
tree decl = gimple_call_fndecl (stmt); tree decl = gimple_call_fndecl (stmt);
tree addr = gimple_call_fn (stmt); tree addr = gimple_call_fn (stmt);
tree funtype = TREE_TYPE (addr); tree funtype = TREE_TYPE (addr);
bool stdarg = false;
if (POINTER_TYPE_P (funtype)) if (POINTER_TYPE_P (funtype))
funtype = TREE_TYPE (funtype); funtype = TREE_TYPE (funtype);
...@@ -3475,17 +3476,26 @@ estimate_num_insns (gimple stmt, eni_weights *weights) ...@@ -3475,17 +3476,26 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
if (!VOID_TYPE_P (TREE_TYPE (funtype))) if (!VOID_TYPE_P (TREE_TYPE (funtype)))
cost += estimate_move_cost (TREE_TYPE (funtype)); cost += estimate_move_cost (TREE_TYPE (funtype));
if (funtype)
stdarg = stdarg_p (funtype);
/* Our cost must be kept in sync with /* Our cost must be kept in sync with
cgraph_estimate_size_after_inlining that does use function cgraph_estimate_size_after_inlining that does use function
declaration to figure out the arguments. */ declaration to figure out the arguments.
if (decl && DECL_ARGUMENTS (decl))
For functions taking variable list of arguments we must
look into call statement intself. This is safe because
we will get only higher costs and in most cases we will
not inline these anyway. */
if (decl && DECL_ARGUMENTS (decl) && !stdarg)
{ {
tree arg; tree arg;
for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg)) for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
if (!VOID_TYPE_P (TREE_TYPE (arg))) if (!VOID_TYPE_P (TREE_TYPE (arg)))
cost += estimate_move_cost (TREE_TYPE (arg)); cost += estimate_move_cost (TREE_TYPE (arg));
} }
else if (funtype && prototype_p (funtype)) else if (funtype && prototype_p (funtype) && !stdarg)
{ {
tree t; tree t;
for (t = TYPE_ARG_TYPES (funtype); t && t != void_list_node; for (t = TYPE_ARG_TYPES (funtype); t && t != void_list_node;
......
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