Commit d402c33d by Jan Hubicka Committed by Jan Hubicka

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
parent e7041633
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> 2010-06-27 Anatoly Sokolov <aesok@post.ru>
* target.h (struct gcc_target): Add register_move_cost field. * target.h (struct gcc_target): Add register_move_cost field.
......
...@@ -2087,6 +2087,13 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments, ...@@ -2087,6 +2087,13 @@ ipa_modify_formal_parameters (tree fndecl, ipa_parm_adjustment_vec adjustments,
DECL_VINDEX (fndecl) = NULL_TREE; 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 /* 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. */ variants. We can handle everything except the main variant lazily. */
t = TYPE_MAIN_VARIANT (orig_type); t = TYPE_MAIN_VARIANT (orig_type);
......
...@@ -277,7 +277,7 @@ consider_split (struct split_point *current, bitmap non_ssa_vars, ...@@ -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 /* 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. */ we can pass more than that. */
if (num_args != bitmap_count_bits (current->ssa_names_to_pass)) if (num_args != bitmap_count_bits (current->ssa_names_to_pass))
{ {
...@@ -843,6 +843,14 @@ split_function (struct split_point *split_point) ...@@ -843,6 +843,14 @@ split_function (struct split_point *split_point)
args_to_skip, args_to_skip,
split_point->split_bbs, split_point->split_bbs,
split_point->entry_bb, "_part"); 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)); cgraph_node_remove_callees (cgraph_node (current_function_decl));
if (!split_part_return_p) if (!split_part_return_p)
TREE_THIS_VOLATILE (node->decl) = 1; TREE_THIS_VOLATILE (node->decl) = 1;
......
2010-06-27 Jan Hubicka <jh@suse.cz>
* gcc.c-torture/compile/pr44686.c: New file.
2010-06-27 Richard Guenther <rguenther@suse.de> 2010-06-27 Richard Guenther <rguenther@suse.de>
PR tree-optimization/44683 PR tree-optimization/44683
......
/* { dg-options "-O2 -fipa-pta -fprofile-generate" } */
void *
memcpy (void *a, const void *b, __SIZE_TYPE__ len)
{
if (a == b)
__builtin_abort ();
}
...@@ -7303,6 +7303,13 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip) ...@@ -7303,6 +7303,13 @@ build_function_decl_skip_args (tree orig_decl, bitmap args_to_skip)
we expect first argument to be THIS pointer. */ we expect first argument to be THIS pointer. */
if (bitmap_bit_p (args_to_skip, 0)) if (bitmap_bit_p (args_to_skip, 0))
DECL_VINDEX (new_decl) = NULL_TREE; 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; return new_decl;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment