Commit 5d737345 by Sebastian Pop Committed by Sebastian Pop

Call scev_reset_htab when Graphite out-of-SSA has changed something.

2010-07-27  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps): Returns
	a bool.
	(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
	(rewrite_commutative_reductions_out_of_ssa_loop): Same.
	(rewrite_cross_bb_scalar_deps_out_of_ssa): Call scev_reset_htab
	when something has been changed.
	(rewrite_commutative_reductions_out_of_ssa): Same.

	* gcc.dg/graphite/id-26.c: New.

From-SVN: r163160
parent ab756588
2010-08-02 Sebastian Pop <sebastian.pop@amd.com> 2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps): Returns
a bool.
(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Same.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Call scev_reset_htab
when something has been changed.
(rewrite_commutative_reductions_out_of_ssa): Same.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (propagate_expr_outside_region): Also * graphite-sese-to-poly.c (propagate_expr_outside_region): Also
handle the case when def is in the sese region. handle the case when def is in the sese region.
(rewrite_close_phi_out_of_ssa): Call propagate_expr_outside_region (rewrite_close_phi_out_of_ssa): Call propagate_expr_outside_region
......
2010-07-27 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps): Returns
a bool.
(rewrite_commutative_reductions_out_of_ssa_close_phi): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Same.
(rewrite_cross_bb_scalar_deps_out_of_ssa): Call scev_reset_htab
when something has been changed.
(rewrite_commutative_reductions_out_of_ssa): Same.
* gcc.dg/graphite/id-26.c: New.
2010-07-26 Sebastian Pop <sebastian.pop@amd.com> 2010-07-26 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (propagate_expr_outside_region): Also * graphite-sese-to-poly.c (propagate_expr_outside_region): Also
......
...@@ -2428,9 +2428,10 @@ rewrite_cross_bb_scalar_dependence (tree zero_dim_array, tree def, gimple use_st ...@@ -2428,9 +2428,10 @@ rewrite_cross_bb_scalar_dependence (tree zero_dim_array, tree def, gimple use_st
} }
/* Rewrite the scalar dependences crossing the boundary of the BB /* Rewrite the scalar dependences crossing the boundary of the BB
containing STMT with an array. */ containing STMT with an array. Return true when something has been
changed. */
static void static bool
rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
{ {
gimple stmt = gsi_stmt (*gsi); gimple stmt = gsi_stmt (*gsi);
...@@ -2439,6 +2440,7 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) ...@@ -2439,6 +2440,7 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
basic_block def_bb; basic_block def_bb;
tree zero_dim_array = NULL_TREE; tree zero_dim_array = NULL_TREE;
gimple use_stmt; gimple use_stmt;
bool res = false;
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
...@@ -2451,27 +2453,29 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) ...@@ -2451,27 +2453,29 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
break; break;
default: default:
return; return false;
} }
if (!is_gimple_reg (def)) if (!is_gimple_reg (def))
return; return false;
if (scev_analyzable_p (def, region)) if (scev_analyzable_p (def, region))
{ {
loop_p loop = loop_containing_stmt (SSA_NAME_DEF_STMT (def)); loop_p loop = loop_containing_stmt (SSA_NAME_DEF_STMT (def));
tree scev = scalar_evolution_in_region (region, loop, def); tree scev = scalar_evolution_in_region (region, loop, def);
if (tree_does_not_contain_chrecs (scev)) if (tree_contains_chrecs (scev, NULL))
propagate_expr_outside_region (def, scev, region); return false;
return; propagate_expr_outside_region (def, scev, region);
return true;
} }
def_bb = gimple_bb (stmt); def_bb = gimple_bb (stmt);
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
if (gimple_code (use_stmt) == GIMPLE_PHI) if (gimple_code (use_stmt) == GIMPLE_PHI
&& (res = true))
{ {
gimple_stmt_iterator psi = gsi_for_stmt (use_stmt); gimple_stmt_iterator psi = gsi_for_stmt (use_stmt);
...@@ -2484,7 +2488,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) ...@@ -2484,7 +2488,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def) FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
if (gimple_code (use_stmt) != GIMPLE_PHI if (gimple_code (use_stmt) != GIMPLE_PHI
&& def_bb != gimple_bb (use_stmt) && def_bb != gimple_bb (use_stmt)
&& !is_gimple_debug (use_stmt)) && !is_gimple_debug (use_stmt)
&& (res = true))
{ {
if (!zero_dim_array) if (!zero_dim_array)
{ {
...@@ -2497,6 +2502,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi) ...@@ -2497,6 +2502,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
rewrite_cross_bb_scalar_dependence (zero_dim_array, def, use_stmt); rewrite_cross_bb_scalar_dependence (zero_dim_array, def, use_stmt);
} }
return res;
} }
/* Rewrite out of SSA all the reduction phi nodes of SCOP. */ /* Rewrite out of SSA all the reduction phi nodes of SCOP. */
...@@ -2507,16 +2514,21 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop) ...@@ -2507,16 +2514,21 @@ rewrite_cross_bb_scalar_deps_out_of_ssa (scop_p scop)
basic_block bb; basic_block bb;
gimple_stmt_iterator psi; gimple_stmt_iterator psi;
sese region = SCOP_REGION (scop); sese region = SCOP_REGION (scop);
bool changed = false;
FOR_EACH_BB (bb) FOR_EACH_BB (bb)
if (bb_in_sese_p (bb, region)) if (bb_in_sese_p (bb, region))
for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi)) for (psi = gsi_start_bb (bb); !gsi_end_p (psi); gsi_next (&psi))
rewrite_cross_bb_scalar_deps (region, &psi); changed |= rewrite_cross_bb_scalar_deps (region, &psi);
update_ssa (TODO_update_ssa); if (changed)
{
scev_reset_htab ();
update_ssa (TODO_update_ssa);
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_loop_closed_ssa (true); verify_loop_closed_ssa (true);
#endif #endif
}
} }
/* Returns the number of pbbs that are in loops contained in SCOP. */ /* Returns the number of pbbs that are in loops contained in SCOP. */
...@@ -2902,26 +2914,31 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in, ...@@ -2902,26 +2914,31 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in,
} }
} }
/* Rewrites out of SSA a commutative reduction at CLOSE_PHI. */ /* Rewrites out of SSA a commutative reduction at CLOSE_PHI. Returns
true when something has been changed. */
static void static bool
rewrite_commutative_reductions_out_of_ssa_close_phi (gimple close_phi, rewrite_commutative_reductions_out_of_ssa_close_phi (gimple close_phi,
sbitmap reductions) sbitmap reductions)
{ {
bool res;
VEC (gimple, heap) *in = VEC_alloc (gimple, heap, 10); VEC (gimple, heap) *in = VEC_alloc (gimple, heap, 10);
VEC (gimple, heap) *out = VEC_alloc (gimple, heap, 10); VEC (gimple, heap) *out = VEC_alloc (gimple, heap, 10);
detect_commutative_reduction (close_phi, &in, &out); detect_commutative_reduction (close_phi, &in, &out);
if (VEC_length (gimple, in) > 0) res = VEC_length (gimple, in) > 0;
if (res)
translate_scalar_reduction_to_array (in, out, reductions); translate_scalar_reduction_to_array (in, out, reductions);
VEC_free (gimple, heap, in); VEC_free (gimple, heap, in);
VEC_free (gimple, heap, out); VEC_free (gimple, heap, out);
return res;
} }
/* Rewrites all the commutative reductions from LOOP out of SSA. */ /* Rewrites all the commutative reductions from LOOP out of SSA.
Returns true when something has been changed. */
static void static bool
rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop, rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
sbitmap reductions, sbitmap reductions,
sese region) sese region)
...@@ -2929,16 +2946,19 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop, ...@@ -2929,16 +2946,19 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
gimple_stmt_iterator gsi; gimple_stmt_iterator gsi;
edge exit = single_exit (loop); edge exit = single_exit (loop);
tree res; tree res;
bool changed = false;
if (!exit) if (!exit)
return; return false;
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi)) for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
if ((res = gimple_phi_result (gsi_stmt (gsi))) if ((res = gimple_phi_result (gsi_stmt (gsi)))
&& is_gimple_reg (res) && is_gimple_reg (res)
&& !scev_analyzable_p (res, region)) && !scev_analyzable_p (res, region))
rewrite_commutative_reductions_out_of_ssa_close_phi (gsi_stmt (gsi), changed |= rewrite_commutative_reductions_out_of_ssa_close_phi
reductions); (gsi_stmt (gsi), reductions);
return changed;
} }
/* Rewrites all the commutative reductions from SCOP out of SSA. */ /* Rewrites all the commutative reductions from SCOP out of SSA. */
...@@ -2948,19 +2968,26 @@ rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions) ...@@ -2948,19 +2968,26 @@ rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions)
{ {
loop_iterator li; loop_iterator li;
loop_p loop; loop_p loop;
bool changed = false;
if (!flag_associative_math) if (!flag_associative_math)
return; return;
FOR_EACH_LOOP (li, loop, 0) FOR_EACH_LOOP (li, loop, 0)
if (loop_in_sese_p (loop, region)) if (loop_in_sese_p (loop, region))
rewrite_commutative_reductions_out_of_ssa_loop (loop, reductions, region); changed |= rewrite_commutative_reductions_out_of_ssa_loop (loop,
reductions,
region);
gsi_commit_edge_inserts (); if (changed)
update_ssa (TODO_update_ssa); {
scev_reset_htab ();
gsi_commit_edge_inserts ();
update_ssa (TODO_update_ssa);
#ifdef ENABLE_CHECKING #ifdef ENABLE_CHECKING
verify_loop_closed_ssa (true); verify_loop_closed_ssa (true);
#endif #endif
}
} }
/* Java does not initialize long_long_integer_type_node. */ /* Java does not initialize long_long_integer_type_node. */
......
2010-08-02 Sebastian Pop <sebastian.pop@amd.com> 2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* gcc.dg/graphite/id-26.c: New.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* gcc.dg/graphite/id-25.c: New. * gcc.dg/graphite/id-25.c: New.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com> 2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
......
int find_sad_16x16(int *intra_mode)
{
int current_intra_sad_2,best_intra_sad2;
int M1[16][16],M0[4][4][4][4],M3[4],M4[4][4];
int i,j,k;
int ii,jj;
int up_avail, left_avail, left_up_avail;
for (i=0;i<17;i++)
if (left_up_avail)
{
for (jj=0;jj<4;jj++)
for (ii=0;ii<4;ii++)
for (j=0;j<4;j++)
for (i=0;i<4;i++)
{
M0[i][ii][2][jj]=M3[0]-M3[1];
M0[i][ii][1][jj]=M3[2]+M3[3];
current_intra_sad_2 += abs(M0[i][ii][j][jj]);
}
if(current_intra_sad_2 < best_intra_sad2)
best_intra_sad2=current_intra_sad_2;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment