+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
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);
}
/* 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,
{
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,
}
/* 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,
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)
{