]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
loop.c (strength_reduce): When placing increment for auto-inc case, do comparison...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sun, 8 Feb 1998 22:59:47 +0000 (22:59 +0000)
committerJeff Law <law@gcc.gnu.org>
Sun, 8 Feb 1998 22:59:47 +0000 (15:59 -0700)
        * loop.c (strength_reduce): When placing increment for auto-inc
        case, do comparison in loop order.

From-SVN: r17786

gcc/ChangeLog
gcc/loop.c

index ebaff2d7969a60a3fc6fc54d7e8d59e6d48d6280..332025bdbc7a0f73fe5a6f5ccde9728c0865ca03 100644 (file)
@@ -1,3 +1,8 @@
+Mon Feb  9 00:01:00 1998  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * loop.c (strength_reduce): When placing increment for auto-inc
+       case, do comparison in loop order.
+
 Fri Jan  2 23:40:09 1998  Jim Wilson  (wilson@cygnus.com)
                          Jeffrey A Law  (law@cygnus.com)
 
index 4bd965d49a55a72934e16591c43fba420704bce2..71cfebd260f0a77944db502bc27d1192d01ac3a6 100644 (file)
@@ -4068,8 +4068,14 @@ strength_reduce (scan_start, end, loop_top, insn_count,
                        auto_inc_opt = 1;
                    }
                  /* Check for case where increment is before the the address
-                    giv.  */
-                 else if (INSN_LUID (v->insn) > INSN_LUID (bl->biv->insn))
+                    giv.  Do this test in "loop order".  */
+                 else if ((INSN_LUID (v->insn) > INSN_LUID (bl->biv->insn)
+                           && (INSN_LUID (v->insn) < INSN_LUID (scan_start)
+                               || (INSN_LUID (bl->biv->insn)
+                                   > INSN_LUID (scan_start))))
+                          || (INSN_LUID (v->insn) < INSN_LUID (scan_start)
+                              && (INSN_LUID (scan_start)
+                                  < INSN_LUID (bl->biv->insn))))
                    auto_inc_opt = -1;
                  else
                    auto_inc_opt = 1;