diff options
author | Jan Hubicka <jh@suse.cz> | 2010-06-01 11:36:21 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-06-01 09:36:21 +0000 |
commit | 613f61fce4c074e54b58302638fabc8cd3fc99d4 (patch) | |
tree | 704c0786f0c407ecce8fbb45e396f7870526a8bc /gcc/tree-inline.c | |
parent | 42ad7bc8a55944289250a2a6949df6c404806d66 (diff) | |
download | gcc-613f61fce4c074e54b58302638fabc8cd3fc99d4.zip gcc-613f61fce4c074e54b58302638fabc8cd3fc99d4.tar.gz gcc-613f61fce4c074e54b58302638fabc8cd3fc99d4.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 3055b57..4ac1b3f 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3367,6 +3367,7 @@ estimate_num_insns (gimple stmt, eni_weights *weights) 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); @@ -3475,17 +3476,26 @@ estimate_num_insns (gimple stmt, eni_weights *weights) if (!VOID_TYPE_P (TREE_TYPE (funtype))) 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. */ - if (decl && DECL_ARGUMENTS (decl)) + 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 = TREE_CHAIN (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) && !stdarg) { tree t; for (t = TYPE_ARG_TYPES (funtype); t && t != void_list_node; |