re PR tree-optimization/42284 (failing tree check in graphite-sese-to-poly.c for 164.gzip)

Fix PR42284.

2009-12-12  Sebastian Pop  <sebpop@gmail.com>

	PR middle-end/42284
	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Call
	insert_out_of_ssa_copy_on_edge for anything else than SSA_NAMEs.
	(detect_commutative_reduction_arg): Simplified.
	(detect_commutative_reduction): Early return when the argument of
	the close phi is not of an SSA_NAME.

	* testsuite/gcc.dg/graphite/pr42284.c: New.

From-SVN: r155218
This commit is contained in:
Sebastian Pop 2009-12-14 16:49:47 +00:00
parent 519517fd49
commit c880097da2
2 changed files with 38 additions and 13 deletions

View File

@ -1,3 +1,20 @@
2009-12-12 Sebastian Pop <sebpop@gmail.com>
PR middle-end/42284
* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Call
insert_out_of_ssa_copy_on_edge for anything else than SSA_NAMEs.
(detect_commutative_reduction_arg): Simplified.
(detect_commutative_reduction): Early return when the argument of
the close phi is not of an SSA_NAME.
* testsuite/gcc.dg/graphite/pr42284.c: New.
2009-12-11 Alexander Monakov <amonakov@ispras.ru>
* dbgcnt.def (graphite_scop): New counter.
* graphite.c: Include dbgcnt.h
(graphite_transform_loops): Use new counter to limit transformations.
2009-12-08 Sebastian Pop <sebpop@gmail.com>
PR middle-end/42285

View File

@ -2186,7 +2186,11 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi)
gimple stmt = gimple_build_assign (res, zero_dim_array);
tree arg = gimple_phi_arg_def (phi, 0);
insert_out_of_ssa_copy (zero_dim_array, arg);
if (TREE_CODE (arg) == SSA_NAME)
insert_out_of_ssa_copy (zero_dim_array, arg);
else
insert_out_of_ssa_copy_on_edge (single_pred_edge (gimple_bb (phi)),
zero_dim_array, arg);
remove_phi_node (psi, false);
gsi_insert_before (&gsi, stmt, GSI_NEW_STMT);
@ -2511,7 +2515,7 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs)
}
/* Detect commutative and associative scalar reductions starting at
the STMT. */
the STMT. Return the phi node of the reduction cycle, or NULL. */
static gimple
detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
@ -2520,18 +2524,16 @@ detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
{
gimple phi = follow_ssa_with_commutative_ops (arg, lhs);
if (phi)
{
VEC_safe_push (gimple, heap, *in, stmt);
VEC_safe_push (gimple, heap, *out, stmt);
return phi;
}
if (!phi)
return NULL;
return NULL;
VEC_safe_push (gimple, heap, *in, stmt);
VEC_safe_push (gimple, heap, *out, stmt);
return phi;
}
/* Detect commutative and associative scalar reductions starting at
the STMT. */
the STMT. Return the phi node of the reduction cycle, or NULL. */
static gimple
detect_commutative_reduction_assign (gimple stmt, VEC (gimple, heap) **in,
@ -2619,7 +2621,8 @@ initial_value_for_loop_phi (gimple phi)
}
/* Detect commutative and associative scalar reductions starting at
the loop closed phi node CLOSE_PHI. */
the loop closed phi node CLOSE_PHI. Return the phi node of the
reduction cycle, or NULL. */
static gimple
detect_commutative_reduction (gimple stmt, VEC (gimple, heap) **in,
@ -2628,8 +2631,13 @@ detect_commutative_reduction (gimple stmt, VEC (gimple, heap) **in,
if (scalar_close_phi_node_p (stmt))
{
tree arg = gimple_phi_arg_def (stmt, 0);
gimple def = SSA_NAME_DEF_STMT (arg);
gimple loop_phi = detect_commutative_reduction (def, in, out);
gimple def, loop_phi;
if (TREE_CODE (arg) != SSA_NAME)
return NULL;
def = SSA_NAME_DEF_STMT (arg);
loop_phi = detect_commutative_reduction (def, in, out);
if (loop_phi)
{