Commit 64cbaace by Sebastian Pop Committed by Sebastian Pop

re PR tree-optimization/34017 (ICE in lambda_loopnest_to_gcc_loopnest with -O2 -ftree-loop-linear)

2008-01-09  Sebastian Pop  <sebastian.pop@amd.com>

	PR tree-optimization/34017
	* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Generate code
	also for PHI_NODE expressions.

	* gcc.dg/tree-ssa/pr34017.c: New.

From-SVN: r131435
parent 684f4f6a
2008-01-09 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/34017
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Generate code
also for PHI_NODE expressions.
2008-01-09 Jan Hubicka <jh@suse.cz> 2008-01-09 Jan Hubicka <jh@suse.cz>
PR tree-optimization/34708 PR tree-optimization/34708
...@@ -1675,7 +1675,6 @@ remove_iv (tree iv_stmt) ...@@ -1675,7 +1675,6 @@ remove_iv (tree iv_stmt)
} }
} }
/* Transform a lambda loopnest NEW_LOOPNEST, which had TRANSFORM applied to /* Transform a lambda loopnest NEW_LOOPNEST, which had TRANSFORM applied to
it, back into gcc code. This changes the it, back into gcc code. This changes the
loops, their induction variables, and their bodies, so that they loops, their induction variables, and their bodies, so that they
...@@ -1699,6 +1698,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1699,6 +1698,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
{ {
struct loop *temp; struct loop *temp;
size_t i = 0; size_t i = 0;
int j;
size_t depth = 0; size_t depth = 0;
VEC(tree,heap) *new_ivs = NULL; VEC(tree,heap) *new_ivs = NULL;
tree oldiv; tree oldiv;
...@@ -1837,8 +1837,6 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1837,8 +1837,6 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
tree newiv, stmts; tree newiv, stmts;
lambda_body_vector lbv, newlbv; lambda_body_vector lbv, newlbv;
gcc_assert (TREE_CODE (stmt) != PHI_NODE);
/* Compute the new expression for the induction /* Compute the new expression for the induction
variable. */ variable. */
depth = VEC_length (tree, new_ivs); depth = VEC_length (tree, new_ivs);
...@@ -1850,7 +1848,8 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1850,7 +1848,8 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv), newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
new_ivs, &stmts); new_ivs, &stmts);
if (stmts)
if (stmts && TREE_CODE (stmt) != PHI_NODE)
{ {
bsi = bsi_for_stmt (stmt); bsi = bsi_for_stmt (stmt);
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
...@@ -1858,6 +1857,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1858,6 +1857,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
propagate_value (use_p, newiv); propagate_value (use_p, newiv);
if (stmts && TREE_CODE (stmt) == PHI_NODE)
for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
if (PHI_ARG_DEF (stmt, j) == newiv)
bsi_insert_on_edge (PHI_ARG_EDGE (stmt, j), stmts);
update_stmt (stmt); update_stmt (stmt);
} }
......
2008-01-09 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/34017
* gcc.dg/tree-ssa/pr34017.c: New.
2008-01-09 Richard Guenther <rguenther@suse.de> 2008-01-09 Richard Guenther <rguenther@suse.de>
Andrew Pinski <andrew_pinski@playstation.sony.com> Andrew Pinski <andrew_pinski@playstation.sony.com>
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear" } */
extern int s;
void
foo (int *x, int y, int z)
{
int m, n;
int o;
int p = x[0];
o = s;
for (m = 0; m < s; m++)
for (n = 0; n < s; n++)
{
if (x[n] != p)
continue;
if (m > z)
z = m;
if (n < o)
o = n;
}
for (m = y; m <= z; m++)
{
}
}
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