loop.c (check_insn_for_bivs): Use ivs->n_regs to check array bounds.
authorMichael Hayes <mhayes@redhat.com>
Mon, 1 Jan 2001 01:04:01 +0000 (01:04 +0000)
committerMichael Hayes <m.hayes@gcc.gnu.org>
Mon, 1 Jan 2001 01:04:01 +0000 (01:04 +0000)
* loop.c (check_insn_for_bivs): Use ivs->n_regs to check array bounds.
(find_mem_givs, record_biv, maybe_eliminate_biv): Likewise.
(record_initial): Likewise.
* unroll.c (copy_loop_body, loop_iterations): Likewise.
(remap_split_bivs): Likewise.

From-SVN: r38584

gcc/ChangeLog
gcc/loop.c
gcc/unroll.c

index 8207a7bf908c04e52ae68b85bfb8b03dcebb24ce..802678e8ede21faf5a5fa64f59067b3d0a70e4d7 100644 (file)
@@ -1,5 +1,13 @@
 2001-01-01  Michael Hayes  <mhayes@redhat.com>
 
+       * loop.c (check_insn_for_bivs): Use ivs->n_regs to check array bounds.
+       (find_mem_givs, record_biv, maybe_eliminate_biv): Likewise.
+       (record_initial): Likewise.
+       * unroll.c (copy_loop_body, loop_iterations): Likewise.
+       (remap_split_bivs): Likewise.
+
+2001-01-01  Michael Hayes  <mhayes@redhat.com> 
+
        * loop.c (loop_ivs_free): New function.
        (strength_reduce): Break out from...
 
index d6c24037f4a5c81b31c6d4e0ce4a685f8cbf50c2..652b5feb9ec71bec544e4ec69a35b3cee43d772f 100644 (file)
@@ -4651,7 +4651,7 @@ check_insn_for_bivs (loop, p, not_every_iteration, maybe_multiple)
                          not_every_iteration, maybe_multiple);
              REG_IV_TYPE (ivs, REGNO (dest_reg)) = BASIC_INDUCT;
            }
-         else if (REGNO (dest_reg) < max_reg_before_loop)
+         else if (REGNO (dest_reg) < ivs->n_regs)
            REG_IV_TYPE (ivs, REGNO (dest_reg)) = NOT_BASIC_INDUCT;
        }
     }
@@ -7842,7 +7842,7 @@ maybe_eliminate_biv (loop, bl, eliminate_p, threshold, insn_count)
                {
                  unsigned int regno = REGNO (SET_DEST (set));
 
-                 if (regno < max_reg_before_loop
+                 if (regno < ivs->n_regs
                      && REG_IV_TYPE (ivs, regno) == GENERAL_INDUCT
                      && REG_IV_INFO (ivs, regno)->src_reg == bl->biv->src_reg)
                    p = last;
@@ -8321,7 +8321,7 @@ record_initial (dest, set, data)
   struct iv_class *bl;
 
   if (GET_CODE (dest) != REG
-      || REGNO (dest) >= max_reg_before_loop
+      || REGNO (dest) >= ivs->n_regs
       || REG_IV_TYPE (ivs, REGNO (dest)) != BASIC_INDUCT)
     return;
 
index 4597343fc3d818c9d774ad4297c9559d6db620fa..b22d01f7a866a10ba1d6ce4d6bd07e7b7a7678c1 100644 (file)
@@ -1912,7 +1912,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
                     for the biv was stored in the biv's first struct
                     induction entry by find_splittable_regs.  */
 
-                 if (regno < max_reg_before_loop
+                 if (regno < ivs->n_regs
                      && REG_IV_TYPE (ivs, regno) == BASIC_INDUCT)
                    {
                      giv_src_reg = REG_IV_CLASS (ivs, regno)->biv->src_reg;
@@ -3591,10 +3591,7 @@ loop_iterations (loop)
     }
   else if (REG_IV_TYPE (ivs, REGNO (iteration_var)) == BASIC_INDUCT)
     {
-      /* When reg_iv_type / reg_iv_info is resized for biv increments
-        that are turned into givs, reg_biv_class is not resized.
-        So check here that we don't make an out-of-bounds access.  */
-      if (REGNO (iteration_var) >= max_reg_before_loop)
+      if (REGNO (iteration_var) >= ivs->n_regs)
        abort ();
 
       /* Grab initial value, only useful if it is a constant.  */
@@ -3609,7 +3606,7 @@ loop_iterations (loop)
       struct induction *v = REG_IV_INFO (ivs, REGNO (iteration_var));
       rtx biv_initial_value;
 
-      if (REGNO (v->src_reg) >= max_reg_before_loop)
+      if (REGNO (v->src_reg) >= ivs->n_regs)
        abort ();
 
       bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
@@ -4012,7 +4009,7 @@ remap_split_bivs (loop, x)
       /* If non-reduced/final-value givs were split, then this would also
         have to remap those givs also.  */
 #endif
-      if (REGNO (x) < max_reg_before_loop
+      if (REGNO (x) < ivs->n_regs
          && REG_IV_TYPE (ivs, REGNO (x)) == BASIC_INDUCT)
        return REG_IV_CLASS (ivs, REGNO (x))->biv->src_reg;
       break;