summaryrefslogtreecommitdiff
path: root/gcc/ipa-inline.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-11-10 21:23:09 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2010-11-10 20:23:09 +0000
commitc5d0600d09df75581455e2152500866aa5d49f2e (patch)
treed022ce30fea75864afaa32f9c9554dbd2b710d9c /gcc/ipa-inline.c
parentd707fc773877a218f563042d5c26657c5d1bd736 (diff)
downloadgcc-c5d0600d09df75581455e2152500866aa5d49f2e.tar.gz
re PR tree-optimization/46228 (code produced for STL container is worse in 4.5.1 than in 4.4.5)
PR tree-optimize/46228 * doc/invoke.texi (comdat-sharing-probability): Document. * ipa-inline.c (cgraph_estimate_growth): Handle COMDATs * params.def (PARAM_COMDAT_SHARING_PROBABILITY): New param. * g++.dg/tree-ssa/pr46228.C: New testcase. From-SVN: r166555
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r--gcc/ipa-inline.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index 61fc6b9992e..d4109c5a21f 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -404,6 +404,12 @@ cgraph_estimate_growth (struct cgraph_node *node)
if (cgraph_will_be_removed_from_program_if_no_direct_calls (node)
&& !DECL_EXTERNAL (node->decl) && !self_recursive)
growth -= node->global.size;
+ /* COMDAT functions are very often not shared across multiple units since they
+ come from various template instantiations. Take this into account. */
+ else if (DECL_COMDAT (node->decl) && !self_recursive
+ && cgraph_can_remove_if_no_direct_calls_p (node))
+ growth -= (node->global.size
+ * (100 - PARAM_VALUE (PARAM_COMDAT_SHARING_PROBABILITY)) + 50) / 100;
node->global.estimated_growth = growth;
return growth;