diff options
author | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-12-18 17:44:06 +0000 |
---|---|---|
committer | bstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-12-18 17:44:06 +0000 |
commit | ad677a4c00c6382897e77ffc2a59aed0f5a59682 (patch) | |
tree | 510ede847c7de6614491e1819125460dd0fbcb32 /gcc/graphite-sese-to-poly.c | |
parent | 12731db0dca15a0a886b6b55b181d8f77e3163b6 (diff) | |
download | gcc-ad677a4c00c6382897e77ffc2a59aed0f5a59682.tar.gz |
2009-12-18 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk rev 155344
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@155348 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r-- | gcc/graphite-sese-to-poly.c | 46 |
1 files changed, 31 insertions, 15 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index 37b20354d6f..370bbff5ddd 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); @@ -2458,9 +2462,14 @@ split_reduction_stmt (gimple stmt) static inline bool is_reduction_operation_p (gimple stmt) { + enum tree_code code; + + gcc_assert (is_gimple_assign (stmt)); + code = gimple_assign_rhs_code (stmt); + return flag_associative_math - && commutative_tree_code (gimple_assign_rhs_code (stmt)) - && associative_tree_code (gimple_assign_rhs_code (stmt)); + && commutative_tree_code (code) + && associative_tree_code (code); } /* Returns true when PHI contains an argument ARG. */ @@ -2496,6 +2505,9 @@ follow_ssa_with_commutative_ops (tree arg, tree lhs) return NULL; } + if (!is_gimple_assign (stmt)) + return NULL; + if (gimple_num_ops (stmt) == 2) return follow_ssa_with_commutative_ops (gimple_assign_rhs1 (stmt), lhs); @@ -2511,7 +2523,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 +2532,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 +2629,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 +2639,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) { |