summaryrefslogtreecommitdiff
path: root/gcc/graphite-sese-to-poly.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-11 20:29:59 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-11 20:29:59 +0000
commited45548015a02297a800704d13f8eba412192e17 (patch)
tree9437c069d3c54b550cb993ccedb5e65a157b348b /gcc/graphite-sese-to-poly.c
parent72085fb747e6e537a982834d2902396c7bc02071 (diff)
downloadgcc-ed45548015a02297a800704d13f8eba412192e17.tar.gz
Fix tonto: call propagate_expr_outside_region.
2010-07-26 Sebastian Pop <sebastian.pop@amd.com> * graphite-sese-to-poly.c (propagate_expr_outside_region): Also handle the case when def is in the sese region. (rewrite_close_phi_out_of_ssa): Call propagate_expr_outside_region for invariant expressions. (rewrite_cross_bb_phi_deps): Removed. (rewrite_cross_bb_scalar_deps): Also handle GIMPLE_PHI nodes. (rewrite_cross_bb_scalar_deps_out_of_ssa): Do not call rewrite_cross_bb_phi_deps. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163159 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/graphite-sese-to-poly.c')
-rw-r--r--gcc/graphite-sese-to-poly.c64
1 files changed, 21 insertions, 43 deletions
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index ae8518f6981..f92c97ef3eb 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2193,8 +2193,7 @@ propagate_expr_outside_region (tree def, tree expr, sese region)
gimple_seq stmts;
bool replaced_once = false;
- gcc_assert (TREE_CODE (def) == SSA_NAME
- && bb_in_sese_p (gimple_bb (SSA_NAME_DEF_STMT (def)), region));
+ gcc_assert (TREE_CODE (def) == SSA_NAME);
expr = force_gimple_operand (unshare_expr (expr), &stmts, true,
NULL_TREE);
@@ -2245,7 +2244,11 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi, sese region)
if (is_gimple_min_invariant (arg)
|| SSA_NAME_IS_DEFAULT_DEF (arg)
|| gimple_bb (SSA_NAME_DEF_STMT (arg))->loop_father == bb->loop_father)
- stmt = gimple_build_assign (res, arg);
+ {
+ propagate_expr_outside_region (res, arg, region);
+ gsi_next (psi);
+ return;
+ }
/* If res is scev analyzable and is not a scalar value, it is safe
to ignore the close phi node: it will be code generated in the
@@ -2262,7 +2265,7 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi, sese region)
scev = compute_overall_effect_of_inner_loop (loop, scev);
}
else
- scev = scalar_evolution_in_region (region, loop, res);
+ scev = scalar_evolution_in_region (region, loop, res);
if (tree_does_not_contain_chrecs (scev))
propagate_expr_outside_region (res, scev, region);
@@ -2425,38 +2428,6 @@ rewrite_cross_bb_scalar_dependence (tree zero_dim_array, tree def, gimple use_st
}
/* Rewrite the scalar dependences crossing the boundary of the BB
- containing STMT with an array. GSI points to a definition that is
- used in a PHI node. */
-
-static void
-rewrite_cross_bb_phi_deps (sese region, gimple_stmt_iterator gsi)
-{
- gimple stmt = gsi_stmt (gsi);
- imm_use_iterator imm_iter;
- tree def;
- gimple use_stmt;
-
- if (gimple_code (stmt) != GIMPLE_ASSIGN)
- return;
-
- def = gimple_assign_lhs (stmt);
- if (!is_gimple_reg (def)
- || scev_analyzable_p (def, region))
- return;
-
- FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
- if (gimple_code (use_stmt) == GIMPLE_PHI)
- {
- gimple_stmt_iterator psi = gsi_for_stmt (use_stmt);
-
- if (scalar_close_phi_node_p (gsi_stmt (psi)))
- rewrite_close_phi_out_of_ssa (&psi, region);
- else
- rewrite_phi_out_of_ssa (&psi);
- }
-}
-
-/* Rewrite the scalar dependences crossing the boundary of the BB
containing STMT with an array. */
static void
@@ -2500,11 +2471,21 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
def_bb = gimple_bb (stmt);
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
- if (def_bb != gimple_bb (use_stmt)
- && !is_gimple_debug (use_stmt))
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
{
- gcc_assert (gimple_code (use_stmt) != GIMPLE_PHI);
+ gimple_stmt_iterator psi = gsi_for_stmt (use_stmt);
+ if (scalar_close_phi_node_p (gsi_stmt (psi)))
+ rewrite_close_phi_out_of_ssa (&psi, region);
+ else
+ rewrite_phi_out_of_ssa (&psi);
+ }
+
+ FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
+ if (gimple_code (use_stmt) != GIMPLE_PHI
+ && def_bb != gimple_bb (use_stmt)
+ && !is_gimple_debug (use_stmt))
+ {
if (!zero_dim_array)
{
zero_dim_array = create_zero_dim_array
@@ -2530,10 +2511,7 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop)
FOR_EACH_BB (bb)
if (bb_in_sese_p (bb, region))
for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
- {
- rewrite_cross_bb_phi_deps (region, psi);
- rewrite_cross_bb_scalar_deps (region, &psi);
- }
+ rewrite_cross_bb_scalar_deps (region, &psi);
update_ssa (TODO_update_ssa);
#ifdef ENABLE_CHECKING