Commit 3a7086cc by Sebastian Pop Committed by Sebastian Pop

Detect commutative reductions in all the scops before rewriting out of SSA all…

Detect commutative reductions in all the scops before rewriting out of SSA all the other scalar dependences.

2010-06-12  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
	(rewrite_reductions_out_of_ssa): Same.
	(rewrite_commutative_reductions_out_of_ssa): Same.
	(build_poly_scop): Do not call these functions.
	* graphite-sese-to-poly.h (build_poly_scop): Declared.
	(rewrite_reductions_out_of_ssa): Declared.
	(rewrite_commutative_reductions_out_of_ssa): Declared.
	* graphite.c (graphite_transform_loops): Call on every scop
	rewrite_commutative_reductions_out_of_ssa before calling
	rewrite_reductions_out_of_ssa and build_scop_bbs.

From-SVN: r163116
parent 61ca46ce
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
(build_poly_scop): Do not call these functions.
* graphite-sese-to-poly.h (build_poly_scop): Declared.
(rewrite_reductions_out_of_ssa): Declared.
(rewrite_commutative_reductions_out_of_ssa): Declared.
* graphite.c (graphite_transform_loops): Call on every scop
rewrite_commutative_reductions_out_of_ssa before calling
rewrite_reductions_out_of_ssa and build_scop_bbs.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (dot_deps): Make system call to dotty run
in background.
(dot_deps_stmt): Same.
......
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
(build_poly_scop): Do not call these functions.
* graphite-sese-to-poly.h (build_poly_scop): Declared.
(rewrite_reductions_out_of_ssa): Declared.
(rewrite_commutative_reductions_out_of_ssa): Declared.
* graphite.c (graphite_transform_loops): Call on every scop
rewrite_commutative_reductions_out_of_ssa before calling
rewrite_reductions_out_of_ssa and build_scop_bbs.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (dot_deps): Make system call to dotty run
in background.
(dot_deps_stmt): Same.
......
......@@ -462,7 +462,7 @@ build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb, sbitmap reductio
/* Gather the basic blocks belonging to the SCOP. */
static void
void
build_scop_bbs (scop_p scop, sbitmap reductions)
{
sbitmap visited = sbitmap_alloc (last_basic_block);
......@@ -2399,7 +2399,7 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
/* Rewrite out of SSA all the reduction phi nodes of SCOP. */
static void
void
rewrite_reductions_out_of_ssa (scop_p scop)
{
basic_block bb;
......@@ -2578,7 +2578,7 @@ detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
}
/* Detect commutative and associative scalar reductions starting at
the STMT. Return the phi node of the reduction cycle, or NULL. */
STMT. Return the phi node of the reduction cycle, or NULL. */
static gimple
detect_commutative_reduction_assign (gimple stmt, VEC (gimple, heap) **in,
......@@ -2666,7 +2666,7 @@ initial_value_for_loop_phi (gimple phi)
}
/* Detect commutative and associative scalar reductions starting at
the loop closed phi node CLOSE_PHI. Return the phi node of the
the loop closed phi node STMT. Return the phi node of the
reduction cycle, or NULL. */
static gimple
......@@ -2874,7 +2874,7 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
/* Rewrites all the commutative reductions from SCOP out of SSA. */
static void
void
rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions)
{
loop_iterator li;
......@@ -2973,14 +2973,8 @@ void
build_poly_scop (scop_p scop)
{
sese region = SCOP_REGION (scop);
sbitmap reductions = sbitmap_alloc (last_basic_block * 2);
graphite_dim_t max_dim;
sbitmap_zero (reductions);
rewrite_commutative_reductions_out_of_ssa (region, reductions);
rewrite_reductions_out_of_ssa (scop);
build_scop_bbs (scop, reductions);
sbitmap_free (reductions);
/* FIXME: This restriction is needed to avoid a problem in CLooG.
Once CLooG is fixed, remove this guard. Anyways, it makes no
......
......@@ -30,5 +30,8 @@ struct base_alias_pair
void build_poly_scop (scop_p);
void check_poly_representation (scop_p);
void rewrite_commutative_reductions_out_of_ssa (sese, sbitmap);
void rewrite_reductions_out_of_ssa (scop_p);
void build_scop_bbs (scop_p, sbitmap);
#endif
......@@ -253,6 +253,7 @@ graphite_transform_loops (void)
bool need_cfg_cleanup_p = false;
VEC (scop_p, heap) *scops = NULL;
htab_t bb_pbb_mapping;
sbitmap reductions;
if (!graphite_initialize ())
return;
......@@ -266,6 +267,19 @@ graphite_transform_loops (void)
}
bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
reductions = sbitmap_alloc (last_basic_block * 2);
sbitmap_zero (reductions);
for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
rewrite_commutative_reductions_out_of_ssa (SCOP_REGION (scop), reductions);
for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
{
rewrite_reductions_out_of_ssa (scop);
build_scop_bbs (scop, reductions);
}
sbitmap_free (reductions);
for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
build_poly_scop (scop);
......
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