loop.c (strength_reduce): Calculate maybe_dead before calling recombine_givs.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Tue, 16 Feb 1999 17:34:35 +0000 (17:34 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Tue, 16 Feb 1999 17:34:35 +0000 (17:34 +0000)
* loop.c (strength_reduce): Calculate maybe_dead before
calling recombine_givs.

From-SVN: r25251

gcc/ChangeLog
gcc/loop.c

index 1b0c8ad45fd38c469293004049c84fd9632f1547..d51cea9a627438ead27e8b15fd3d6fdc98d08367 100644 (file)
@@ -1,3 +1,8 @@
+Wed Feb 17 01:29:07 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * loop.c (strength_reduce): Calculate maybe_dead before
+       calling recombine_givs.
+
 Wed Feb 17 00:43:12 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
 
        * loop.c (strength_reduce): Dump biv increment -> giv conversions.
index 81ed3e13e4e0dbecfd91b7979dde4da153b6a4af..0979b999e5cc6becf095f96bca5859bca0d5eff7 100644 (file)
@@ -4621,6 +4621,35 @@ strength_reduce (scan_start, end, loop_top, insn_count,
            }
        }
 
+      /* Check for givs whose first use is their definition and whose
+        last use is the definition of another giv.  If so, it is likely
+        dead and should not be used to derive another giv nor to
+        eliminate a biv.  */
+      for (v = bl->giv; v; v = v->next_iv)
+       {
+         if (v->ignore
+             || (v->same && v->same->ignore))
+           continue;
+
+         if (v->last_use)
+           {
+             struct induction *v1;
+
+             for (v1 = bl->giv; v1; v1 = v1->next_iv)
+               if (v->last_use == v1->insn)
+                 v->maybe_dead = 1;
+           }
+         else if (v->giv_type == DEST_REG
+             && REGNO_FIRST_UID (REGNO (v->dest_reg)) == INSN_UID (v->insn))
+           {
+             struct induction *v1;
+
+             for (v1 = bl->giv; v1; v1 = v1->next_iv)
+               if (REGNO_LAST_UID (REGNO (v->dest_reg)) == INSN_UID (v1->insn))
+                 v->maybe_dead = 1;
+           }
+       }
+
 #if 0
       /* XXX Temporary.  */
       /* Now that we know which givs will be reduced, try to rearrange the
@@ -4789,11 +4818,8 @@ strength_reduce (scan_start, end, loop_top, insn_count,
         
         For each giv register that can be reduced now: if replaceable,
         substitute reduced reg wherever the old giv occurs;
-        else add new move insn "giv_reg = reduced_reg".
+        else add new move insn "giv_reg = reduced_reg".  */
 
-        Also check for givs whose first use is their definition and whose
-        last use is the definition of another giv.  If so, it is likely
-        dead and should not be used to eliminate a biv.  */
       for (v = bl->giv; v; v = v->next_iv)
        {
          if (v->same && v->same->ignore)
@@ -4802,24 +4828,6 @@ strength_reduce (scan_start, end, loop_top, insn_count,
          if (v->ignore)
            continue;
 
-         if (v->last_use)
-           {
-             struct induction *v1;
-
-             for (v1 = bl->giv; v1; v1 = v1->next_iv)
-               if (v->last_use == v1->insn)
-                 v->maybe_dead = 1;
-           }
-         else if (v->giv_type == DEST_REG
-             && REGNO_FIRST_UID (REGNO (v->dest_reg)) == INSN_UID (v->insn))
-           {
-             struct induction *v1;
-
-             for (v1 = bl->giv; v1; v1 = v1->next_iv)
-               if (REGNO_LAST_UID (REGNO (v->dest_reg)) == INSN_UID (v1->insn))
-                 v->maybe_dead = 1;
-           }
-
          /* Update expression if this was combined, in case other giv was
             replaced.  */
          if (v->same)