loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is used to compute...
authorJeffrey A Law <law@cygnus.com>
Wed, 30 Sep 1998 17:32:15 +0000 (17:32 +0000)
committerJeff Law <law@gcc.gnu.org>
Wed, 30 Sep 1998 17:32:15 +0000 (11:32 -0600)
        * loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is
        used to compute a giv or as some other non-counting use.

From-SVN: r22684

gcc/ChangeLog
gcc/loop.c

index 5e224d718286f3ab31c3b04979484e832fc61f27..81faece302f19a9de43c59932426df31a03e50a5 100644 (file)
@@ -1,3 +1,8 @@
+Wed Sep 30 18:29:26 1998  Jeffrey A Law  (law@cygnus.com)
+
+       * loop.c (check_dbra_loop): Use a vanilla loop reversal if the biv is
+       used to compute a giv or as some other non-counting use.
+
 Wed Sep 30 18:19:27 1998  Michael Hayes  <m.hayes@elec.canterbury.ac.nz>
 
        * regs.h (HARD_REGNO_CALLER_SAVE_MODE): New macro.
index 0a6cf059b4479f70b88ce6aba4827b100a099441..f8e4d8d06b9ab56ccc2d00380151560b6a2ae635 100644 (file)
@@ -6992,9 +6992,13 @@ check_dbra_loop (loop_end, insn_count, loop_start)
              if (initial_value == const0_rtx
                  /* If we have a decrement_and_branch_on_count, prefer
                     the NE test, since this will allow that instruction to
-                    be generated.  */
+                    be generated.  Note that we must use a vanilla loop
+                    reversal if the biv is used to calculate a giv or has
+                    a non-counting use.  */
 #if ! defined (HAVE_decrement_and_branch_until_zero) && defined (HAVE_decrement_and_branch_on_count)
-                 && (add_val != 1 || ! vtop)
+                 && (! (add_val == 1 && vtop
+                        && (bl->biv_count == 0
+                            || no_use_except_counting)))
 #endif
                  && GET_CODE (comparison_value) == CONST_INT
                     /* Now do postponed overflow checks on COMPARISON_VAL.  */
@@ -7007,7 +7011,9 @@ check_dbra_loop (loop_end, insn_count, loop_start)
                  nonneg = 1;
                  cmp_code = GE;
                }
-             else if (add_val == 1 && vtop)
+             else if (add_val == 1 && vtop
+                      && (bl->biv_count == 0
+                          || no_use_except_counting))
                {
                  add_adjust = 0;
                  cmp_code = NE;