Do not translate out-of-SSA close phi nodes that can be analyzed with scev.

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

	* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add an
	extra parameter for the region.  Call scev_analyzable_p.
	(rewrite_reductions_out_of_ssa): Update call to
	rewrite_close_phi_out_of_ssa.
	(rewrite_cross_bb_phi_deps): Same.
	(rewrite_commutative_reductions_out_of_ssa_loop): Add an extra
	parameter for the region.  Call scev_analyzable_p.
	(rewrite_commutative_reductions_out_of_ssa): Update call to
	rewrite_commutative_reductions_out_of_ssa_loop.

From-SVN: r163151
This commit is contained in:
Sebastian Pop 2010-08-11 20:28:54 +00:00 committed by Sebastian Pop
parent 5df5f257f5
commit a7d00e71ed
3 changed files with 41 additions and 7 deletions

View File

@ -1,3 +1,15 @@
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add an
extra parameter for the region. Call scev_analyzable_p.
(rewrite_reductions_out_of_ssa): Update call to
rewrite_close_phi_out_of_ssa.
(rewrite_cross_bb_phi_deps): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Add an extra
parameter for the region. Call scev_analyzable_p.
(rewrite_commutative_reductions_out_of_ssa): Update call to
rewrite_commutative_reductions_out_of_ssa_loop.
2010-08-02 Sebastian Pop <sebastian.pop@amd.com>
* sese.c (rename_uses): Call unshare_expr before force_gimple_operand.

View File

@ -1,3 +1,15 @@
2010-07-20 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (rewrite_close_phi_out_of_ssa): Add an
extra parameter for the region. Call scev_analyzable_p.
(rewrite_reductions_out_of_ssa): Update call to
rewrite_close_phi_out_of_ssa.
(rewrite_cross_bb_phi_deps): Same.
(rewrite_commutative_reductions_out_of_ssa_loop): Add an extra
parameter for the region. Call scev_analyzable_p.
(rewrite_commutative_reductions_out_of_ssa): Update call to
rewrite_commutative_reductions_out_of_ssa_loop.
2010-07-20 Sebastian Pop <sebastian.pop@amd.com>
* gcc.dg/tree-ssa/pr20742.c: New.

View File

@ -2186,7 +2186,7 @@ scalar_close_phi_node_p (gimple phi)
dimension array for it. */
static void
rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi)
rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi, sese region)
{
gimple phi = gsi_stmt (*psi);
tree res = gimple_phi_result (phi);
@ -2201,6 +2201,14 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi)
before Graphite: see canonicalize_loop_closed_ssa_form. */
gcc_assert (gimple_phi_num_args (phi) == 1);
/* If res is scev analyzable, it is safe to ignore the close phi
node: it will be code generated in the out of Graphite pass. */
if (scev_analyzable_p (res, region))
{
gsi_next (psi);
return;
}
/* The phi node can be a non close phi node, when its argument is
invariant, or when it is defined in the same loop as the phi node. */
if (is_gimple_min_invariant (arg)
@ -2321,7 +2329,7 @@ rewrite_reductions_out_of_ssa (scop_p scop)
rewrite_degenerate_phi (&psi);
else if (scalar_close_phi_node_p (phi))
rewrite_close_phi_out_of_ssa (&psi);
rewrite_close_phi_out_of_ssa (&psi, region);
else if (reduction_phi_p (region, &psi))
rewrite_phi_out_of_ssa (&psi);
@ -2386,7 +2394,7 @@ rewrite_cross_bb_phi_deps (sese region, gimple_stmt_iterator gsi)
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);
rewrite_close_phi_out_of_ssa (&psi, region);
else
rewrite_phi_out_of_ssa (&psi);
}
@ -2871,7 +2879,8 @@ rewrite_commutative_reductions_out_of_ssa_close_phi (gimple close_phi,
static void
rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
sbitmap reductions)
sbitmap reductions,
sese region)
{
gimple_stmt_iterator gsi;
edge exit = single_exit (loop);
@ -2880,8 +2889,9 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
return;
for (gsi = gsi_start_phis (exit->dest); !gsi_end_p (gsi); gsi_next (&gsi))
rewrite_commutative_reductions_out_of_ssa_close_phi (gsi_stmt (gsi),
reductions);
if (!scev_analyzable_p (gimple_phi_result (gsi_stmt (gsi)), region))
rewrite_commutative_reductions_out_of_ssa_close_phi (gsi_stmt (gsi),
reductions);
}
/* Rewrites all the commutative reductions from SCOP out of SSA. */
@ -2897,7 +2907,7 @@ rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions)
FOR_EACH_LOOP (li, loop, 0)
if (loop_in_sese_p (loop, region))
rewrite_commutative_reductions_out_of_ssa_loop (loop, reductions);
rewrite_commutative_reductions_out_of_ssa_loop (loop, reductions, region);
gsi_commit_edge_inserts ();
update_ssa (TODO_update_ssa);