This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Bug: loop incr optimised to a constant


At 15:02 08.11.99 , Franz Sirl wrote:
>Unless one of the loop experts tackles this, I will look at that later 
>today or tomorrow.

The appended little patch from the mainline sources solves this problem for 
me. Mark, please try the patch on your platform. If it fixes the problem 
for you too, the patch should go into the release branch.

Franz.

1999-08-31 12:20 -0700 Zack Weinberg <zack@bitmover.com>
         * loop.c (check_dbra_loop): Check bl->biv->add_val is a
         CONST_INT before using its INTVAL.

Index: loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.179
retrieving revision 1.180
diff -u -p -r1.179 -r1.180
--- loop.c      1999/08/29 10:09:28     1.179
+++ loop.c      1999/08/31 19:39:05     1.180
@@ -7797,7 +7797,8 @@ check_dbra_loop (loop_end, insn_count, l
             }
         }
      }
-  else if (INTVAL (bl->biv->add_val) > 0)
+  else if (GET_CODE (bl->biv->add_val) == CONST_INT
+          && INTVAL (bl->biv->add_val) > 0)
      {
        /* Try to change inc to dec, so can apply above optimization.  */
        /* Can do this if:

loop.patch


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]