aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2015-03-16 20:39:14 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2015-03-16 19:39:14 +0000
commit7a161d5be3314a90bcb5870986edc8b230446c46 (patch)
tree9a850b8072dd5819878a551ca92ae4b3d348c994 /gcc
parentf8c29d983969a1dd7a8563ba0f2432733e88e76f (diff)
downloadgcc-7a161d5be3314a90bcb5870986edc8b230446c46.zip
gcc-7a161d5be3314a90bcb5870986edc8b230446c46.tar.gz
gcc-7a161d5be3314a90bcb5870986edc8b230446c46.tar.bz2
tree-sra.c (ipa_sra_preliminary_function_checks): Use DECL_ONE_ONLY to check if decl is one only.
* tree-sra.c (ipa_sra_preliminary_function_checks): Use DECL_ONE_ONLY to check if decl is one only. * ipa-split.c (consider_split): Limit splitt of one only functions. From-SVN: r221466
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-split.c25
-rw-r--r--gcc/tree-sra.c2
3 files changed, 32 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index c849fd9..51650a2 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-16 Jan Hubicka <hubicka@ucw.cz>
+
+ * tree-sra.c (ipa_sra_preliminary_function_checks): Use
+ DECL_ONE_ONLY to check if decl is one only.
+ * ipa-split.c (consider_split): Limit splitt of one only functions.
+
2015-03-16 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/65427
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 7e68a87..5640238 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -598,6 +598,31 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
return;
}
+ /* Splitting functions brings the target out of comdat group; this will
+ lead to code duplication if the function is reused by other unit.
+ Limit this duplication. This is consistent with limit in tree-sra.c
+ FIXME: with LTO we ought to be able to do better! */
+ if (DECL_ONE_ONLY (current_function_decl)
+ && current->split_size >= (unsigned int) MAX_INLINE_INSNS_AUTO)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: function is COMDAT and tail is too large\n");
+ return;
+ }
+ /* For comdat functions also reject very small tails; those will likely get
+ inlined back and we do not want to risk the duplication overhead.
+ FIXME: with LTO we ought to be able to do better! */
+ if (DECL_ONE_ONLY (current_function_decl)
+ && current->split_size
+ <= (unsigned int) PARAM_VALUE (PARAM_EARLY_INLINING_INSNS) / 2)
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file,
+ " Refused: function is COMDAT and tail is too small\n");
+ return;
+ }
+
/* FIXME: we currently can pass only SSA function parameters to the split
arguments. Once parm_adjustment infrastructure is supported by cloning,
we can pass more than that. */
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index a49e950..91b72fb 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -5109,7 +5109,7 @@ ipa_sra_preliminary_function_checks (struct cgraph_node *node)
return false;
}
- if ((DECL_COMDAT (node->decl) || DECL_EXTERNAL (node->decl))
+ if ((DECL_ONE_ONLY (node->decl) || DECL_EXTERNAL (node->decl))
&& inline_summaries->get (node)->size >= MAX_INLINE_INSNS_AUTO)
{
if (dump_file)