Commit a4681954 by Sebastian Pop Committed by Sebastian Pop

Fix PR42914 and PR42530.

2010-02-10  Sebastian Pop  <seb@napoca>

	PR middle-end/42914
	PR middle-end/42530
	* graphite-sese-to-poly.c (remove_phi): New.
	(translate_scalar_reduction_to_array): Call remove_phi.

	* gcc.dg/graphite/pr42530.c: New.
	* gcc.dg/graphite/pr42914.c: New.

From-SVN: r156712
parent a1954f72
2010-02-10 Sebastian Pop <seb@napoca>
PR middle-end/42914
PR middle-end/42530
* graphite-sese-to-poly.c (remove_phi): New.
(translate_scalar_reduction_to_array): Call remove_phi.
* gcc.dg/graphite/pr42530.c: New.
* gcc.dg/graphite/pr42914.c: New.
2010-02-10 Sebastian Pop <seb@napoca>
PR middle-end/42771
* graphite-clast-to-gimple.c (gloog): Call rename_sese_parameters.
* graphite-clast-to-gimple.h (gloog): Update declaration.
......
......@@ -2719,6 +2719,41 @@ insert_copyin (tree red, gimple loop_phi)
gsi_insert_seq_on_edge (edge_initial_value_for_loop_phi (loop_phi), stmts);
}
/* Removes the PHI node and resets all the debug stmts that are using
the PHI_RESULT. */
static void
remove_phi (gimple phi)
{
imm_use_iterator imm_iter;
tree def;
use_operand_p use_p;
gimple_stmt_iterator gsi;
VEC (gimple, heap) *update = VEC_alloc (gimple, heap, 3);
unsigned int i;
gimple stmt;
def = PHI_RESULT (phi);
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, def)
{
stmt = USE_STMT (use_p);
if (is_gimple_debug (stmt))
{
gimple_debug_bind_reset_value (stmt);
VEC_safe_push (gimple, heap, update, stmt);
}
}
for (i = 0; VEC_iterate (gimple, update, i, stmt); i++)
update_stmt (stmt);
VEC_free (gimple, heap, update);
gsi = gsi_for_phi_node (phi);
remove_phi_node (&gsi, false);
}
/* Rewrite out of SSA the reduction described by the loop phi nodes
IN, and the close phi nodes OUT. IN and OUT are structured by loop
levels like this:
......@@ -2737,7 +2772,6 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in,
unsigned int i;
gimple loop_phi;
tree red;
gimple_stmt_iterator gsi;
for (i = 0; VEC_iterate (gimple, in, i, loop_phi); i++)
{
......@@ -2764,11 +2798,8 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in,
insert_copyin (red, loop_phi);
}
gsi = gsi_for_phi_node (loop_phi);
remove_phi_node (&gsi, false);
gsi = gsi_for_phi_node (close_phi);
remove_phi_node (&gsi, false);
remove_phi (loop_phi);
remove_phi (close_phi);
}
}
......
/* { dg-options "-O2 -g -ffast-math -floop-parallelize-all" } */
int array[2][2];
void foo(int *a)
{
int i, j;
int sum, tmp = 0;
for (i=0; i<2; i++)
for (j=0; j<2; j++)
sum += array[i][j];
if (sum > 0) {
tmp = sum;
*a = tmp;
}
}
/* { dg-options "-O2 -g -ffast-math -fgraphite-identity" } */
int find_sad_16x16(int *mode)
{
int current, best;
int M1[16][16],M0[4][4][4][4],M3[4],M4[4][4];
int i,j,k;
int ii,jj;
for (jj=0;jj<4;jj++)
for (ii=0;ii<4;ii++)
for (j=0;j<4;j++)
for (j=0;j<4;j++)
current += abs(M0[i][ii][j][jj]);
if(current < best)
{
best = current;
*mode = k;
}
}
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