re PR middle-end/42749 (-O2 and verify_stmts failed again)

2010-02-22  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/42749
	* tree-tailcall.c (adjust_return_value_with_ops): Drop update
	parameter.  Do arithmetic in the original type.
	(update_accumulator_with_ops): Likewise.
	(adjust_accumulator_values): Adjust.

	* gcc.c-torture/compile/pr42749.c: New testcase.

From-SVN: r156960
This commit is contained in:
Richard Guenther 2010-02-22 14:09:26 +00:00 committed by Richard Biener
parent 0a88561f0a
commit 9efc83f4ba
4 changed files with 55 additions and 10 deletions

View File

@ -1,3 +1,11 @@
2010-02-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42749
* tree-tailcall.c (adjust_return_value_with_ops): Drop update
parameter. Do arithmetic in the original type.
(update_accumulator_with_ops): Likewise.
(adjust_accumulator_values): Adjust.
2010-02-22 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.md ("movqi"): Re-add the mem->mem alternative.

View File

@ -1,3 +1,8 @@
2010-02-22 Richard Guenther <rguenther@suse.de>
PR tree-optimization/42749
* gcc.c-torture/compile/pr42749.c: New testcase.
2010-02-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43072

View File

@ -0,0 +1,5 @@
struct pdf_object { int val; };
int pdf_count_size_object (struct pdf_object * p_obj)
{
return pdf_count_size_object(p_obj) + 2 * sizeof(struct pdf_object);
}

View File

@ -570,23 +570,37 @@ add_successor_phi_arg (edge e, tree var, tree phi_arg)
static tree
adjust_return_value_with_ops (enum tree_code code, const char *label,
tree op0, tree op1, gimple_stmt_iterator gsi,
enum gsi_iterator_update update)
tree acc, tree op1, gimple_stmt_iterator gsi)
{
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
tree tmp = create_tmp_var (ret_type, label);
gimple stmt = gimple_build_assign_with_ops (code, tmp, op0, op1);
gimple stmt;
tree result;
if (TREE_CODE (ret_type) == COMPLEX_TYPE
|| TREE_CODE (ret_type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (tmp) = 1;
add_referenced_var (tmp);
if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
stmt = gimple_build_assign_with_ops (code, tmp, acc, op1);
else
{
tree rhs = fold_convert (TREE_TYPE (acc),
fold_build2 (code,
TREE_TYPE (op1),
fold_convert (TREE_TYPE (op1), acc),
op1));
rhs = force_gimple_operand_gsi (&gsi, rhs,
false, NULL, true, GSI_CONTINUE_LINKING);
stmt = gimple_build_assign (NULL_TREE, rhs);
}
result = make_ssa_name (tmp, stmt);
gimple_assign_set_lhs (stmt, result);
update_stmt (stmt);
gsi_insert_before (&gsi, stmt, update);
gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
return result;
}
@ -599,9 +613,22 @@ static tree
update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
gimple_stmt_iterator gsi)
{
gimple stmt = gimple_build_assign_with_ops (code, SSA_NAME_VAR (acc), acc,
op1);
tree var = make_ssa_name (SSA_NAME_VAR (acc), stmt);
gimple stmt;
tree var;
if (types_compatible_p (TREE_TYPE (acc), TREE_TYPE (op1)))
stmt = gimple_build_assign_with_ops (code, SSA_NAME_VAR (acc), acc, op1);
else
{
tree rhs = fold_convert (TREE_TYPE (acc),
fold_build2 (code,
TREE_TYPE (op1),
fold_convert (TREE_TYPE (op1), acc),
op1));
rhs = force_gimple_operand_gsi (&gsi, rhs,
false, NULL, false, GSI_CONTINUE_LINKING);
stmt = gimple_build_assign (NULL_TREE, rhs);
}
var = make_ssa_name (SSA_NAME_VAR (acc), stmt);
gimple_assign_set_lhs (stmt, var);
update_stmt (stmt);
gsi_insert_after (&gsi, stmt, GSI_NEW_STMT);
@ -631,7 +658,7 @@ adjust_accumulator_values (gimple_stmt_iterator gsi, tree m, tree a, edge back)
var = m_acc;
else
var = adjust_return_value_with_ops (MULT_EXPR, "acc_tmp", m_acc,
a, gsi, GSI_NEW_STMT);
a, gsi);
}
else
var = a;
@ -667,10 +694,10 @@ adjust_return_value (basic_block bb, tree m, tree a)
if (m)
retval = adjust_return_value_with_ops (MULT_EXPR, "mul_tmp", m_acc, retval,
gsi, GSI_SAME_STMT);
gsi);
if (a)
retval = adjust_return_value_with_ops (PLUS_EXPR, "acc_tmp", a_acc, retval,
gsi, GSI_SAME_STMT);
gsi);
gimple_return_set_retval (ret_stmt, retval);
update_stmt (ret_stmt);
}