aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-06-28 02:10:34 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2010-06-28 00:10:34 +0000
commitd402c33dc1fa4ea0a9f133efdc18ae43b4b4c916 (patch)
tree6ab1c2265180e9232911690d3ba0715ff2be32d0 /gcc
parente7041633a5b9ac8eb09b92de5321bf3184a7b98f (diff)
downloadgcc-d402c33dc1fa4ea0a9f133efdc18ae43b4b4c916.zip
gcc-d402c33dc1fa4ea0a9f133efdc18ae43b4b4c916.tar.gz
gcc-d402c33dc1fa4ea0a9f133efdc18ae43b4b4c916.tar.bz2
re PR middle-end/44671 (Partial inlining breaks C++)
PR middle-end/44671 PR middle-end/44686 * tree.c (build_function_decl_skip_args): Clear DECL_BUILT_IN on signature change. * ipa-split.c (split_function): Always clear DECL_BUILT_IN. * ipa-prop.c (ipa_modify_formal_parameters): Likewise. * gcc.c-torture/pr44686.c: New file. From-SVN: r161476
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/ipa-prop.c7
-rw-r--r--gcc/ipa-split.c10
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr44686.c7
-rw-r--r--gcc/tree.c7
6 files changed, 43 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a1fe90..d53ba696 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2010-06-27 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/44671
+ PR middle-end/44686
+ * tree.c (build_function_decl_skip_args): Clear DECL_BUILT_IN on signature
+ change.
+ * ipa-split.c (split_function): Always clear DECL_BUILT_IN.
+ * ipa-prop.c (ipa_modify_formal_parameters): Likewise.
+
2010-06-27 Anatoly Sokolov <aesok@post.ru>
* target.h (struct gcc_target): Add register_move_cost field.
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index 3fd284b..997f8ec 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -2087,6 +2087,13 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
DECL_VINDEX (fndecl) = NULL_TREE;
}
+ /* When signature changes, we need to clear builtin info. */
+ if (DECL_BUILT_IN (fndecl))
+ {
+ DECL_BUILT_IN_CLASS (fndecl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0;
+ }
+
/* This is a new type, not a copy of an old type. Need to reassociate
variants. We can handle everything except the main variant lazily. */
t = TYPE_MAIN_VARIANT (orig_type);
diff --git a/gcc/ipa-split.c b/gcc/ipa-split.c
index 1216b0f..ccc89c4 100644
--- a/gcc/ipa-split.c
+++ b/gcc/ipa-split.c
@@ -277,7 +277,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars,
}
/* FIXME: we currently can pass only SSA function parameters to the split
- arguments. Once parm_adjustment infrastructure is supported by clonning,
+ arguments. Once parm_adjustment infrastructure is supported by cloning,
we can pass more than that. */
if (num_args != bitmap_count_bits (current->ssa_names_to_pass))
{
@@ -843,6 +843,14 @@ split_function (struct split_point *split_point)
args_to_skip,
split_point->split_bbs,
split_point->entry_bb, "_part");
+ /* For usual cloning it is enough to clear builtin only when signature
+ changes. For partial inlining we however can not expect the part
+ of builtin implementation to have same semantic as the whole. */
+ if (DECL_BUILT_IN (node->decl))
+ {
+ DECL_BUILT_IN_CLASS (node->decl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (node->decl) = (enum built_in_function) 0;
+ }
cgraph_node_remove_callees (cgraph_node (current_function_decl));
if (!split_part_return_p)
TREE_THIS_VOLATILE (node->decl) = 1;
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 75a47a2..be888c8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2010-06-27 Jan Hubicka <jh@suse.cz>
+
+ * gcc.c-torture/compile/pr44686.c: New file.
+
2010-06-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44683
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr44686.c b/gcc/testsuite/gcc.c-torture/compile/pr44686.c
new file mode 100644
index 0000000..eacd83d
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr44686.c
@@ -0,0 +1,7 @@
+/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */
+void *
+memcpy (void *a, const void *b, __SIZE_TYPE__ len)
+{
+ if (a == b)
+ __builtin_abort ();
+}
diff --git a/gcc/tree.c b/gcc/tree.c
index a02ac39..5e7de01 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -7303,6 +7303,13 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip)
we expect first argument to be THIS pointer. */
if (bitmap_bit_p (args_to_skip, 0))
DECL_VINDEX (new_decl) = NULL_TREE;
+
+ /* When signature changes, we need to clear builtin info. */
+ if (DECL_BUILT_IN (new_decl) && !bitmap_empty_p (args_to_skip))
+ {
+ DECL_BUILT_IN_CLASS (new_decl) = NOT_BUILT_IN;
+ DECL_FUNCTION_CODE (new_decl) = (enum built_in_function) 0;
+ }
return new_decl;
}