diff options
author | Richard Guenther <rguenther@suse.de> | 2011-04-06 08:56:28 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-04-06 08:56:28 +0000 |
commit | ff5d142c9e5debaec4ebb8d1c61734bae42fd25e (patch) | |
tree | 78fc627717f18d03bd2f359321819749ba6cbc55 | |
parent | d7d1d041aedeeb19cc16c718ec517aaeac81c10e (diff) | |
download | gcc-ff5d142c9e5debaec4ebb8d1c61734bae42fd25e.zip gcc-ff5d142c9e5debaec4ebb8d1c61734bae42fd25e.tar.gz gcc-ff5d142c9e5debaec4ebb8d1c61734bae42fd25e.tar.bz2 |
tree-inline.c (estimate_num_insns): For calls simply account for all passed arguments and a used return value.
2011-04-06 Richard Guenther <rguenther@suse.de>
* tree-inline.c (estimate_num_insns): For calls simply account
for all passed arguments and a used return value.
From-SVN: r172024
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/tree-inline.c | 52 |
2 files changed, 10 insertions, 47 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7b473e8..24207ac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,9 @@ 2011-04-06 Richard Guenther <rguenther@suse.de> + + * tree-inline.c (estimate_num_insns): For calls simply account + for all passed arguments and a used return value. + +2011-04-06 Richard Guenther <rguenther@suse.de> PR tree-optimization/47663 * cgraph.h (struct cgraph_edge): Add call_stmt_size and diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index a6dac2d..b4f9dcd 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3470,12 +3470,6 @@ estimate_num_insns (gimple stmt, eni_weights *weights) case GIMPLE_CALL: { tree decl = gimple_call_fndecl (stmt); - tree addr = gimple_call_fn (stmt); - tree funtype = TREE_TYPE (addr); - bool stdarg = false; - - if (POINTER_TYPE_P (funtype)) - funtype = TREE_TYPE (funtype); /* Do not special case builtins where we see the body. This just confuse inliner. */ @@ -3511,49 +3505,13 @@ estimate_num_insns (gimple stmt, eni_weights *weights) } cost = weights->call_cost; - if (decl) - funtype = TREE_TYPE (decl); - - if (!VOID_TYPE_P (TREE_TYPE (funtype)) - && gimple_call_lhs (stmt)) - cost += estimate_move_cost (TREE_TYPE (funtype)); - - if (funtype) - stdarg = stdarg_p (funtype); - - /* Our cost must be kept in sync with - cgraph_estimate_size_after_inlining that does use function - declaration to figure out the arguments. - - 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; - for (arg = DECL_ARGUMENTS (decl); arg; arg = DECL_CHAIN (arg)) - if (!VOID_TYPE_P (TREE_TYPE (arg))) - cost += estimate_move_cost (TREE_TYPE (arg)); - } - else if (funtype && prototype_p (funtype) && !stdarg) - { - tree t; - for (t = TYPE_ARG_TYPES (funtype); t && t != void_list_node; - t = TREE_CHAIN (t)) - if (!VOID_TYPE_P (TREE_VALUE (t))) - cost += estimate_move_cost (TREE_VALUE (t)); - } - else + if (gimple_call_lhs (stmt)) + cost += estimate_move_cost (TREE_TYPE (gimple_call_lhs (stmt))); + 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); - if (!VOID_TYPE_P (TREE_TYPE (arg))) - cost += estimate_move_cost (TREE_TYPE (arg)); - } + tree arg = gimple_call_arg (stmt, i); + cost += estimate_move_cost (TREE_TYPE (arg)); } - break; } |