diff options
author | Jan Hubicka <jh@suse.cz> | 2010-11-10 03:35:19 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2010-11-10 02:35:19 +0000 |
commit | 9bb2f479f391114f46f6cb5d957b274ff0066135 (patch) | |
tree | c179f7d98e8b98e288509bbe8a5cf077dada2455 /gcc/tree-inline.c | |
parent | b8cbdff525821c2ca8aa8758ed48d50f101138db (diff) | |
download | gcc-9bb2f479f391114f46f6cb5d957b274ff0066135.zip gcc-9bb2f479f391114f46f6cb5d957b274ff0066135.tar.gz gcc-9bb2f479f391114f46f6cb5d957b274ff0066135.tar.bz2 |
re PR tree-optimization/40436 (0.5% code size regression caused by r147852)
PR tree-optimization/40436
* ipa-inline.c (leaf_node_p): Implement using is_inexpensive_builtin.
* tree-inline.c (estimate_num_insns): Inexpensive builtins are like
normal instructions; be sure bultin is not implemented in this file;
compute non-zero return cost.
(init_inline_once): Reduce builtin_call_cost to 1; set return cost.
* tree-inline.h (eni_weights_d): Add return cost.
From-SVN: r166517
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 88806be..fc470a7 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3484,10 +3484,16 @@ estimate_num_insns (gimple stmt, eni_weights *weights) if (POINTER_TYPE_P (funtype)) funtype = TREE_TYPE (funtype); - if (is_simple_builtin (decl)) + /* Do not special case builtins where we see the body. + This just confuse inliner. */ + if (!decl || cgraph_node (decl)->analyzed) + cost = weights->call_cost; + /* For buitins that are likely expanded to nothing or + inlined do not account operand costs. */ + else if (is_simple_builtin (decl)) return 0; else if (is_inexpensive_builtin (decl)) - cost = weights->target_builtin_call_cost; + return weights->target_builtin_call_cost; else cost = weights->call_cost; @@ -3536,11 +3542,13 @@ estimate_num_insns (gimple stmt, eni_weights *weights) break; } + case GIMPLE_RETURN: + return weights->return_cost; + case GIMPLE_GOTO: case GIMPLE_LABEL: case GIMPLE_NOP: case GIMPLE_PHI: - case GIMPLE_RETURN: case GIMPLE_PREDICT: case GIMPLE_DEBUG: return 0; @@ -3640,16 +3648,18 @@ init_inline_once (void) eni_size_weights.div_mod_cost = 1; eni_size_weights.omp_cost = 40; eni_size_weights.time_based = false; + eni_size_weights.return_cost = 1; /* Estimating time for call is difficult, since we have no idea what the called function does. In the current uses of eni_time_weights, underestimating the cost does less harm than overestimating it, so we choose a rather small value here. */ eni_time_weights.call_cost = 10; - eni_time_weights.target_builtin_call_cost = 10; + eni_time_weights.target_builtin_call_cost = 1; eni_time_weights.div_mod_cost = 10; eni_time_weights.omp_cost = 40; eni_time_weights.time_based = true; + eni_time_weights.return_cost = 2; } /* Estimate the number of instructions in a gimple_seq. */ |