Commit 9efc83f4 by Richard Guenther Committed by Richard Biener

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
parent 0a88561f
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> 2010-02-22 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* config/s390/s390.md ("movqi"): Re-add the mem->mem alternative. * config/s390/s390.md ("movqi"): Re-add the mem->mem alternative.
......
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> 2010-02-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/43072 PR fortran/43072
......
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);
}
...@@ -570,23 +570,37 @@ add_successor_phi_arg (edge e, tree var, tree phi_arg) ...@@ -570,23 +570,37 @@ add_successor_phi_arg (edge e, tree var, tree phi_arg)
static tree static tree
adjust_return_value_with_ops (enum tree_code code, const char *label, adjust_return_value_with_ops (enum tree_code code, const char *label,
tree op0, tree op1, gimple_stmt_iterator gsi, tree acc, tree op1, gimple_stmt_iterator gsi)
enum gsi_iterator_update update)
{ {
tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl)); tree ret_type = TREE_TYPE (DECL_RESULT (current_function_decl));
tree tmp = create_tmp_var (ret_type, label); tree tmp = create_tmp_var (ret_type, label);
gimple stmt = gimple_build_assign_with_ops (code, tmp, op0, op1); gimple stmt;
tree result; tree result;
if (TREE_CODE (ret_type) == COMPLEX_TYPE if (TREE_CODE (ret_type) == COMPLEX_TYPE
|| TREE_CODE (ret_type) == VECTOR_TYPE) || TREE_CODE (ret_type) == VECTOR_TYPE)
DECL_GIMPLE_REG_P (tmp) = 1; DECL_GIMPLE_REG_P (tmp) = 1;
add_referenced_var (tmp); 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); result = make_ssa_name (tmp, stmt);
gimple_assign_set_lhs (stmt, result); gimple_assign_set_lhs (stmt, result);
update_stmt (stmt); update_stmt (stmt);
gsi_insert_before (&gsi, stmt, update); gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
return result; return result;
} }
...@@ -599,9 +613,22 @@ static tree ...@@ -599,9 +613,22 @@ static tree
update_accumulator_with_ops (enum tree_code code, tree acc, tree op1, update_accumulator_with_ops (enum tree_code code, tree acc, tree op1,
gimple_stmt_iterator gsi) gimple_stmt_iterator gsi)
{ {
gimple stmt = gimple_build_assign_with_ops (code, SSA_NAME_VAR (acc), acc, gimple stmt;
op1); tree var;
tree var = make_ssa_name (SSA_NAME_VAR (acc), stmt); 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); gimple_assign_set_lhs (stmt, var);
update_stmt (stmt); update_stmt (stmt);
gsi_insert_after (&gsi, stmt, GSI_NEW_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) ...@@ -631,7 +658,7 @@ adjust_accumulator_values (gimple_stmt_iterator gsi, tree m, tree a, edge back)
var = m_acc; var = m_acc;
else else
var = adjust_return_value_with_ops (MULT_EXPR, "acc_tmp", m_acc, var = adjust_return_value_with_ops (MULT_EXPR, "acc_tmp", m_acc,
a, gsi, GSI_NEW_STMT); a, gsi);
} }
else else
var = a; var = a;
...@@ -667,10 +694,10 @@ adjust_return_value (basic_block bb, tree m, tree a) ...@@ -667,10 +694,10 @@ adjust_return_value (basic_block bb, tree m, tree a)
if (m) if (m)
retval = adjust_return_value_with_ops (MULT_EXPR, "mul_tmp", m_acc, retval, retval = adjust_return_value_with_ops (MULT_EXPR, "mul_tmp", m_acc, retval,
gsi, GSI_SAME_STMT); gsi);
if (a) if (a)
retval = adjust_return_value_with_ops (PLUS_EXPR, "acc_tmp", a_acc, retval, 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); gimple_return_set_retval (ret_stmt, retval);
update_stmt (ret_stmt); update_stmt (ret_stmt);
} }
......
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