diff options
author | Sebastian Pop <spop@gcc.gnu.org> | 2009-12-14 16:49:47 +0000 |
---|---|---|
committer | Sebastian Pop <spop@gcc.gnu.org> | 2009-12-14 16:49:47 +0000 |
commit | c880097da2610870e56955fd53808fddd442223c (patch) | |
tree | e935081b3cab99f08a242643172e2734e2bc61c4 /gcc | |
parent | 519517fd497032bb67c1231a31c6422c3b17b928 (diff) | |
download | gcc-c880097da2610870e56955fd53808fddd442223c.zip gcc-c880097da2610870e56955fd53808fddd442223c.tar.gz gcc-c880097da2610870e56955fd53808fddd442223c.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog.graphite | 17 | ||||
-rw-r--r-- | gcc/graphite-sese-to-poly.c | 34 |
2 files changed, 38 insertions, 13 deletions
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite index a9197a5..9974d19 100644 --- a/gcc/ChangeLog.graphite +++ b/gcc/ChangeLog.graphite @@ -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 diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 37b2035..1eb0696 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -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) { |