public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* patch for bug 42640
@ 2010-03-01 18:46 Yazdani, Reza
  2010-03-01 18:54 ` Sebastian Pop
  0 siblings, 1 reply; 6+ messages in thread
From: Yazdani, Reza @ 2010-03-01 18:46 UTC (permalink / raw)
  To: gcc-patches; +Cc: Pop, Sebastian, mmitchel, janis

[-- Attachment #1: Type: text/plain, Size: 2996 bytes --]

Problem description and Fix for bug 42640:

The loop distribution is done using SSA forms and in this case the SSA of the original loop is not propagated correctly to the distributed loops. Here is the loop with problem. 


      for (iloop = 1; iloop <= 2; iloop++)
        {
          rr_node[inode].a = i;
          rr_node[inode].b = j;
          rr_node[inode].c = ipad;

          inode = p_node;
        }

inode has a value of 0 at the loop entry (see attached pr42640.c). It has the value of p_node in the second iteration. The intermediate code for this loop before distribution is:

  loop_2 (header = 5, latch = 6, niter = , upper_bound = 2, estimate = 2)
  {
    bb_5 (preds = {bb_6 bb_4 }, succs = {bb_6 bb_7 })
    {
    <bb 5>:
      # inode_18 = PHI <p_node_6(6), ipad_17(4)>
      # iloop_20 = PHI <iloop_25(6), 1(4)>
      # .MEM_21 = PHI <.MEM_32(6), .MEM_15(4)>
      D.3359_11 = (long unsigned int) inode_18;
      D.3360_12 = D.3359_11 * 12;
      D.3361_13 = pretmp.10_35 + D.3360_12;
      # .MEM_30 = VDEF <.MEM_21>
      D.3361_13->a = i_14(D);
      # .MEM_31 = VDEF <.MEM_30>
      D.3361_13->b = j_19(D);
      # .MEM_32 = VDEF <.MEM_31>
      D.3361_13->c = ipad_17;
      iloop_25 = iloop_20 + 1;
      if (iloop_25 <= 2)
        goto <bb 6>;
      else
        goto <bb 7>;

    }

"inode_18 = PHI <p_node_6(6), ipad_17(4)>" is the PHI function describing the induction variable.

After the distribution the first loop is (see after_dis.txt):

  loop_4 (header = 13, latch = 14, niter = )
  {
    bb_13 (preds = {bb_14 bb_12 }, succs = {bb_14 bb_15 })
    {
    <bb 13>:
      # inode_44 = PHI <inode_44(14), ipad_17(12)>
      # iloop_45 = PHI <iloop_53(14), 1(12)>
      # .MEM_55 = PHI <.MEM_51(14), .MEM_23(12)>
      D.3359_47 = (long unsigned int) inode_44;
      D.3360_48 = D.3359_47 * 12;
      D.3361_49 = pretmp.10_35 + D.3360_48;
      # .MEM_51 = VDEF <.MEM_55>
      D.3361_49->b = j_19(D);
      iloop_53 = iloop_45 + 1;
      if (iloop_53 <= 2)
        goto <bb 14>;
      else
        goto <bb 15>;

    }
    bb_14 (preds = {bb_13 }, succs = {bb_13 })
    {
    <bb 14>:
      goto <bb 13>;

    }
  }

Induction variable is:"# inode_44 = PHI <inode_44(14), ipad_17(12)>"

Note that inode_44 is never initialized in the outer loop.
---------------------------------------------------------------------------

This patch initialize the PHI functions for indexed functions assigned to an invariant variables in a distributed loops to the value of the PHI function used in the original loop.

Suggested ChangeLog entry:

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

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

Passed bootstrap and tested with no regressions the testsuite on amd64-linux.



Reza Yazdani

[-- Attachment #2: gcc.diff.txt --]
[-- Type: text/plain, Size: 2578 bytes --]

Index: tree-loop-distribution.c
===================================================================
--- tree-loop-distribution.c	(revision 155240)
+++ tree-loop-distribution.c	(working copy)
@@ -118,8 +118,8 @@ update_phis_for_loop_copy (struct loop *
 
 	  if (!new_ssa_name)
 	    /* This only happens if there are no definitions inside the
-	       loop.  Use the phi_result in this case.  */
-	    new_ssa_name = PHI_RESULT (phi_new);
+	       loop.  Use the invariant in the new loop as is. */
+	    new_ssa_name = def;
 	}
       else
 	/* Could be an integer.  */
Index: testsuite/gcc.dg/tree-ssa/pr42640.c
===================================================================
--- testsuite/gcc.dg/tree-ssa/pr42640.c	(revision 0)
+++ testsuite/gcc.dg/tree-ssa/pr42640.c	(revision 0)
@@ -0,0 +1,68 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -ftree-loop-distribution" } */
+
+/* Checks if loop distribution works correctly if the subscript used 
+   is assigned to a loop invariant value.  */
+
+#include <stdio.h>
+
+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);
+
+  int passed = 1;
+
+  if (rr_node[0].a != rr_node[1].a || rr_node[2].a != rr_node[3].a ||
+      rr_node[1].a != 1)
+    passed = 0;
+  else if (rr_node[0].b != rr_node[1].b || rr_node[2].b != rr_node[3].b ||
+	   rr_node[1].b != 2)
+    passed = 0;
+  else if (rr_node[0].c != 0 || rr_node[1].c != 1 ||
+	   rr_node[2].c != 0 || rr_node[3].c != 1)
+    passed = 0;
+
+  if (!passed)
+  {
+    for (i = 0; i < 4; i++)
+      printf ("rr_node[%d] = %d %d %d\n", i,
+	      rr_node[i].a,
+	      rr_node[i].b,
+	      rr_node[i].c);
+
+    printf ("FAIL\n");
+  }
+  else
+    printf ("PASS\n");
+}
Index: cfgloop.c
===================================================================
--- cfgloop.c	(revision 155240)
+++ cfgloop.c	(working copy)
@@ -1328,7 +1328,6 @@ verify_loop_structure (void)
   unsigned num = number_of_loops ();
   loop_iterator li;
   struct loop_exit *exit, *mexit;
-
   /* Check sizes.  */
   sizes = XCNEWVEC (unsigned, num);
   sizes[0] = 2;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch for bug 42640
  2010-03-01 18:46 patch for bug 42640 Yazdani, Reza
@ 2010-03-01 18:54 ` Sebastian Pop
  2010-03-01 19:11   ` Paolo Carlini
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Pop @ 2010-03-01 18:54 UTC (permalink / raw)
  To: Yazdani, Reza; +Cc: gcc-patches, mmitchel, janis, Richard Guenther

On Mon, Mar 1, 2010 at 12:46, Yazdani, Reza <Reza.Yazdani@amd.com> wrote:
> Problem description and Fix for bug 42640:
>
> The loop distribution is done using SSA forms and in this case the SSA of the original loop is not propagated correctly to the distributed loops. Here is the loop with problem.
>
>
>      for (iloop = 1; iloop <= 2; iloop++)
>        {
>          rr_node[inode].a = i;
>          rr_node[inode].b = j;
>          rr_node[inode].c = ipad;
>
>          inode = p_node;
>        }
>
> inode has a value of 0 at the loop entry (see attached pr42640.c). It has the value of p_node in the second iteration. The intermediate code for this loop before distribution is:
>
>  loop_2 (header = 5, latch = 6, niter = , upper_bound = 2, estimate = 2)
>  {
>    bb_5 (preds = {bb_6 bb_4 }, succs = {bb_6 bb_7 })
>    {
>    <bb 5>:
>      # inode_18 = PHI <p_node_6(6), ipad_17(4)>
>      # iloop_20 = PHI <iloop_25(6), 1(4)>
>      # .MEM_21 = PHI <.MEM_32(6), .MEM_15(4)>
>      D.3359_11 = (long unsigned int) inode_18;
>      D.3360_12 = D.3359_11 * 12;
>      D.3361_13 = pretmp.10_35 + D.3360_12;
>      # .MEM_30 = VDEF <.MEM_21>
>      D.3361_13->a = i_14(D);
>      # .MEM_31 = VDEF <.MEM_30>
>      D.3361_13->b = j_19(D);
>      # .MEM_32 = VDEF <.MEM_31>
>      D.3361_13->c = ipad_17;
>      iloop_25 = iloop_20 + 1;
>      if (iloop_25 <= 2)
>        goto <bb 6>;
>      else
>        goto <bb 7>;
>
>    }
>
> "inode_18 = PHI <p_node_6(6), ipad_17(4)>" is the PHI function describing the induction variable.
>
> After the distribution the first loop is (see after_dis.txt):
>
>  loop_4 (header = 13, latch = 14, niter = )
>  {
>    bb_13 (preds = {bb_14 bb_12 }, succs = {bb_14 bb_15 })
>    {
>    <bb 13>:
>      # inode_44 = PHI <inode_44(14), ipad_17(12)>
>      # iloop_45 = PHI <iloop_53(14), 1(12)>
>      # .MEM_55 = PHI <.MEM_51(14), .MEM_23(12)>
>      D.3359_47 = (long unsigned int) inode_44;
>      D.3360_48 = D.3359_47 * 12;
>      D.3361_49 = pretmp.10_35 + D.3360_48;
>      # .MEM_51 = VDEF <.MEM_55>
>      D.3361_49->b = j_19(D);
>      iloop_53 = iloop_45 + 1;
>      if (iloop_53 <= 2)
>        goto <bb 14>;
>      else
>        goto <bb 15>;
>
>    }
>    bb_14 (preds = {bb_13 }, succs = {bb_13 })
>    {
>    <bb 14>:
>      goto <bb 13>;
>
>    }
>  }
>
> Induction variable is:"# inode_44 = PHI <inode_44(14), ipad_17(12)>"
>
> Note that inode_44 is never initialized in the outer loop.
> ---------------------------------------------------------------------------
>
> This patch initialize the PHI functions for indexed functions assigned to an invariant variables in a distributed loops to the value of the PHI function used in the original loop.
>
> Suggested ChangeLog entry:
>
> "2010-02-26  Reza Yazdani  <reza.yazdani@amd.com>
>
>        PR middle-end/42640
>        * (tree-loop-distribution.c): replaced the assignment
>          from new induction variable to the assignment of the
>        value from the original loop PHI function."
>
> Passed bootstrap and tested with no regressions the testsuite on amd64-linux.
>

This looks good to me, but I cannot approve it.
Richi, could you also have a look at this patch?

Thanks,
Sebastian Pop
--
AMD / Open Source Compiler Engineering / GNU Tools

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch for bug 42640
  2010-03-01 18:54 ` Sebastian Pop
@ 2010-03-01 19:11   ` Paolo Carlini
  2010-03-01 20:18     ` Sebastian Pop
  0 siblings, 1 reply; 6+ messages in thread
From: Paolo Carlini @ 2010-03-01 19:11 UTC (permalink / raw)
  To: Sebastian Pop
  Cc: Yazdani, Reza, gcc-patches, mmitchel, janis, Richard Guenther

On 03/01/2010 07:54 PM, Sebastian Pop wrote:
> This looks good to me, but I cannot approve it.
> Richi, could you also have a look at this patch?
>   
Well, for sure you don't want a testcase printfs-based like that... ;)
Also, the ChangeLog entry needs some trivial stylistic tweaks, I think.

Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch for bug 42640
  2010-03-01 19:11   ` Paolo Carlini
@ 2010-03-01 20:18     ` Sebastian Pop
  2010-03-02 10:07       ` Richard Guenther
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Pop @ 2010-03-01 20:18 UTC (permalink / raw)
  To: Paolo Carlini
  Cc: Yazdani, Reza, gcc-patches, mmitchel, janis, Richard Guenther

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

On Mon, Mar 1, 2010 at 13:11, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> On 03/01/2010 07:54 PM, Sebastian Pop wrote:
>> This looks good to me, but I cannot approve it.
>> Richi, could you also have a look at this patch?
>>
> Well, for sure you don't want a testcase printfs-based like that... ;)
> Also, the ChangeLog entry needs some trivial stylistic tweaks, I think.
>

Here is an updated patch correcting these issues.

Sebastian Pop
--
AMD / Open Source Compiler Engineering / GNU Tools

[-- Attachment #2: 0001-Fix-PR42640-Correctly-initialize-the-value-of-the-ne.patch --]
[-- Type: text/x-diff, Size: 2734 bytes --]

From 53691c3bad76b9093ac540c2d4d2230524a8aad3 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Mon, 1 Mar 2010 14:13:14 -0600
Subject: [PATCH] Fix PR42640: Correctly initialize the value of the new induction variable.

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

	PR middle-end/42640
	* (tree-loop-distribution.c): 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.
---
 gcc/testsuite/gcc.dg/tree-ssa/pr42640.c |   58 +++++++++++++++++++++++++++++++
 gcc/tree-loop-distribution.c            |    4 +-
 2 files changed, 60 insertions(+), 2 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr42640.c

diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
new file mode 100644
index 0000000..70807c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
@@ -0,0 +1,58 @@
+/* { 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;
+}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 13ac7ea..920ab8c 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -118,8 +118,8 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
 
 	  if (!new_ssa_name)
 	    /* This only happens if there are no definitions inside the
-	       loop.  Use the phi_result in this case.  */
-	    new_ssa_name = PHI_RESULT (phi_new);
+	       loop.  Use the the invariant in the new loop as is.  */
+	    new_ssa_name = def;
 	}
       else
 	/* Could be an integer.  */
-- 
1.6.3.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch for bug 42640
  2010-03-01 20:18     ` Sebastian Pop
@ 2010-03-02 10:07       ` Richard Guenther
  2010-03-02 10:23         ` Sebastian Pop
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Guenther @ 2010-03-02 10:07 UTC (permalink / raw)
  To: Sebastian Pop; +Cc: Paolo Carlini, Yazdani, Reza, gcc-patches, mmitchel, janis

On Mon, 1 Mar 2010, Sebastian Pop wrote:

> On Mon, Mar 1, 2010 at 13:11, Paolo Carlini <paolo.carlini@oracle.com> wrote:
> > On 03/01/2010 07:54 PM, Sebastian Pop wrote:
> >> This looks good to me, but I cannot approve it.
> >> Richi, could you also have a look at this patch?
> >>
> > Well, for sure you don't want a testcase printfs-based like that... ;)
> > Also, the ChangeLog entry needs some trivial stylistic tweaks, I think.
> >
> 
> Here is an updated patch correcting these issues.

The patch is ok with

        * (tree-loop-distribution.c): Replaced the assignment from the

proper changelog format is

	* tree-loop-distribution.c (update_phis_for_loop_copy): Replaced

Thanks,
Richard.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: patch for bug 42640
  2010-03-02 10:07       ` Richard Guenther
@ 2010-03-02 10:23         ` Sebastian Pop
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2010-03-02 10:23 UTC (permalink / raw)
  To: Richard Guenther
  Cc: Paolo Carlini, Yazdani, Reza, gcc-patches, mmitchel, janis

[-- Attachment #1: Type: text/plain, Size: 421 bytes --]

On Tue, Mar 2, 2010 at 04:07, Richard Guenther <rguenther@suse.de> wrote:
> The patch is ok with
>
>        * (tree-loop-distribution.c): Replaced the assignment from the
>
> proper changelog format is
>
>        * tree-loop-distribution.c (update_phis_for_loop_copy): Replaced
>

Right.  How comes that I was not able to see this? ;-)
I corrected this and committed to trunk the attached patch.

Sebastian

[-- Attachment #2: 0001-Fix-PR42640-Correctly-initialize-the-value-of-the-ne.patch --]
[-- Type: text/x-diff, Size: 4577 bytes --]

From a56e4518b716a9b2da181fe56ec073581ea1313c Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Mon, 1 Mar 2010 14:13:14 -0600
Subject: [PATCH] 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.
---
 gcc/ChangeLog                           |   13 +++++--
 gcc/testsuite/ChangeLog                 |    5 +++
 gcc/testsuite/gcc.dg/tree-ssa/pr42640.c |   58 +++++++++++++++++++++++++++++++
 gcc/tree-loop-distribution.c            |    4 +-
 4 files changed, 75 insertions(+), 5 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr42640.c

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 47e217f..9e9755a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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>
 	    Daniel Jacobowitz  <dan@codesourcery.com>
 
@@ -27,7 +34,7 @@
 2010-03-01  Christian Bruel  <christian.bruel@st.com>
 
 	* except.c (dw2_build_landing_pads): set LABEL_PRESERVE_P.
-	
+
 2010-03-01  H.J. Lu  <hongjiu.lu@intel.com>
 
 	* config/i386/linux64.h (ASM_SPEC): Use SPEC_32 and SPEC_64.
@@ -47,7 +54,7 @@
 	64-bit, SPARC and x86.
 	(sol_gt_pch_get_address): New function.
 
-2010-03-01  Marco Poletti  <poletti.marco@gmail.com> 
+2010-03-01  Marco Poletti  <poletti.marco@gmail.com>
 
 	* toplev.h (inform_n, error_n): Declare.
 	* diagnostic.c (inform_n, error_n): New function.
@@ -133,7 +140,7 @@
 	* doc/standards.texi: Likewise.
 	* doc/extend.texi: Likewise.
 	* doc/trouble.texi: Likewise.
-	* doc/cppopts.texi: Likewise. 
+	* doc/cppopts.texi: Likewise.
 	* doc/install.texi: Likewise.
 	* c.opt (std=c90,std=gnu90): New options.
 	* c-opts.c (c_common_handle_option): Handle them.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 6e72856..63ceb9a 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+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>
 
 	PR tree-optimization/43220
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
new file mode 100644
index 0000000..70807c0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr42640.c
@@ -0,0 +1,58 @@
+/* { 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;
+}
diff --git a/gcc/tree-loop-distribution.c b/gcc/tree-loop-distribution.c
index 13ac7ea..920ab8c 100644
--- a/gcc/tree-loop-distribution.c
+++ b/gcc/tree-loop-distribution.c
@@ -118,8 +118,8 @@ update_phis_for_loop_copy (struct loop *orig_loop, struct loop *new_loop)
 
 	  if (!new_ssa_name)
 	    /* This only happens if there are no definitions inside the
-	       loop.  Use the phi_result in this case.  */
-	    new_ssa_name = PHI_RESULT (phi_new);
+	       loop.  Use the the invariant in the new loop as is.  */
+	    new_ssa_name = def;
 	}
       else
 	/* Could be an integer.  */
-- 
1.6.3.3


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-03-02 10:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01 18:46 patch for bug 42640 Yazdani, Reza
2010-03-01 18:54 ` Sebastian Pop
2010-03-01 19:11   ` Paolo Carlini
2010-03-01 20:18     ` Sebastian Pop
2010-03-02 10:07       ` Richard Guenther
2010-03-02 10:23         ` Sebastian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).