unroll.c (loop_iterations): If we cannot prove iteration variable is set once in...
authorJakub Jelinek <jakub@redhat.com>
Sat, 13 Jan 2001 21:54:10 +0000 (22:54 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 13 Jan 2001 21:54:10 +0000 (22:54 +0100)
* unroll.c (loop_iterations): If we cannot prove iteration variable
is set once in each iteration, punt.

From-SVN: r38996

gcc/ChangeLog
gcc/unroll.c

index cea3dc86717463cdd7ce075f02398ee8b5b10055..d775e76da5e77cdf44ec300f8ec0ef6ca705b1d0 100644 (file)
@@ -1,3 +1,8 @@
+2001-01-13  Jakub Jelinek  <jakub@redhat.com>
+
+       * unroll.c (loop_iterations): If we cannot prove iteration variable
+       is set once in each iteration, punt.
+
 Sun Jan 14 00:23:15 2001  Denis Chertykov  <denisc@overta.ru>
 
        * config/avr/avr.md ("strlenhi"): Remove clobber of input address.
index 11be66d89cc15359c075ec50a6cffbb58e34a2a9..9289595d0397fecf3b5467b1e121189ef5233845 100644 (file)
@@ -3577,6 +3577,13 @@ loop_iterations (loop)
       /* Grab initial value, only useful if it is a constant.  */
       bl = REG_IV_CLASS (ivs, REGNO (iteration_var));
       initial_value = bl->initial_value;
+      if (!bl->biv->always_executed || bl->biv->maybe_multiple)
+       {
+         if (loop_dump_stream)
+           fprintf (loop_dump_stream,
+                    "Loop iterations: Basic induction var not set once in each iteration.\n");
+         return 0;
+       }
 
       increment = biv_total_increment (bl);
     }
@@ -3589,6 +3596,14 @@ loop_iterations (loop)
       if (REGNO (v->src_reg) >= ivs->n_regs)
        abort ();
 
+      if (!v->always_executed || v->maybe_multiple)
+       {
+         if (loop_dump_stream)
+           fprintf (loop_dump_stream,
+                    "Loop iterations: General induction var not set once in each iteration.\n");
+         return 0;
+       }
+
       bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
 
       /* Increment value is mult_val times the increment value of the biv.  */