diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-10 20:23:09 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-11-10 20:23:09 +0000 |
commit | 6a2657be2cb25b26f6159f933d967ca02ecf03d2 (patch) | |
tree | d022ce30fea75864afaa32f9c9554dbd2b710d9c /gcc/ipa-inline.c | |
parent | 4cbad5bb3917e54e5127f191ae27384b1b81fcc5 (diff) | |
download | gcc-6a2657be2cb25b26f6159f933d967ca02ecf03d2.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@166555 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 6 |
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; |