Commit 61226dc8 by Sebastian Pop

Fix PR42640: Correctly initialize the value of the new induction variable.

2010-03-02  Reza Yazdani  <reza.yazdani@amd.com>

	PR middle-end/42640
	* tree-loop-distribution.c (update_phis_for_loop_copy): Replaced
	the assignment from the new induction variable to the assignment
	of the value from the original loop PHI function.

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

From-SVN: r157161
parent ef74edbd
2010-03-02 Reza Yazdani <reza.yazdani@amd.com>
PR middle-end/42640
* tree-loop-distribution.c (update_phis_for_loop_copy): Replaced
the assignment from the new induction variable to the assignment
of the value from the original loop PHI function.
2010-03-01 Janis Johnson <janis187@us.ibm.com> 2010-03-01 Janis Johnson <janis187@us.ibm.com>
Daniel Jacobowitz <dan@codesourcery.com> Daniel Jacobowitz <dan@codesourcery.com>
......
2010-03-02 Reza Yazdani <reza.yazdani@amd.com>
PR middle-end/42640
* gcc.dg/tree-ssa/pr42640.c: New.
2010-03-01 Richard Guenther <rguenther@suse.de> 2010-03-01 Richard Guenther <rguenther@suse.de>
PR tree-optimization/43220 PR tree-optimization/43220
......
/* { dg-do run } */
/* { dg-options "-O2 -ftree-loop-distribution" } */
/* Checks if loop distribution works correctly if the subscript used
is assigned to a loop invariant value. */
extern void abort (void);
struct S { int a; int b; int c; };
int get_rr_node_index (int i)
{
return i;
}
struct S nodes[8];
struct S *rr_node = nodes;
volatile int io_rat = 2;
void
doit (int i, int j)
{
int s_node, p_node, inode, ipad, iloop;
for (ipad = 0; ipad < io_rat; ipad++)
{
p_node = get_rr_node_index (ipad+2);
inode = get_rr_node_index (ipad);
for (iloop = 1; iloop <= 2; iloop++)
{
rr_node[inode].a = i;
rr_node[inode].b = j;
rr_node[inode].c = ipad;
inode = p_node;
}
}
}
int
main ()
{
int i;
doit (1, 2);
if (rr_node[0].a != rr_node[1].a
|| rr_node[2].a != rr_node[3].a
|| rr_node[1].a != 1
|| rr_node[0].b != rr_node[1].b
|| rr_node[2].b != rr_node[3].b
|| rr_node[1].b != 2
|| rr_node[0].c != 0
|| rr_node[1].c != 1
|| rr_node[2].c != 0
|| rr_node[3].c != 1)
abort ();
return 0;
}
...@@ -118,8 +118,8 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop) ...@@ -118,8 +118,8 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
if (!new_ssa_name) if (!new_ssa_name)
/* This only happens if there are no definitions inside the /* This only happens if there are no definitions inside the
loop. Use the phi_result in this case. */ loop. Use the the invariant in the new loop as is. */
new_ssa_name = PHI_RESULT (phi_new); new_ssa_name = def;
} }
else else
/* Could be an integer. */ /* Could be an integer. */
......
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