doloop.c (doloop_modify_runtime): Properly select induction variable...
authorRichard Henderson <rth@redhat.com>
Wed, 28 Nov 2001 18:09:26 +0000 (10:09 -0800)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 28 Nov 2001 18:09:26 +0000 (10:09 -0800)
        * doloop.c (doloop_modify_runtime): Properly select induction
        variable; skip late entry test if biv initializer created by loop.

From-SVN: r47423

gcc/ChangeLog
gcc/doloop.c

index 849630ba3680eb0e2be402a08f5ab1c040346cef..0407789369711bfd49f48747904efaa5c0cf159b 100644 (file)
@@ -1,3 +1,8 @@
+2001-11-28  Richard Henderson  <rth@redhat.com>
+
+       * doloop.c (doloop_modify_runtime): Properly select induction
+       variable; skip late entry test if biv initializer created by loop.
+
 Wed Nov 28 08:21:47 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
 
        * tree.h (EXPR_WFL_LINECOL): Used by Java in node other than
index be232d63e6c85fcf6f93f7e23fc61ba436d7a5c2..cf50d68509648ce82920b8b8842bbe721736023e 100644 (file)
@@ -621,11 +621,23 @@ doloop_modify_runtime (loop, iterations_max,
 
   if (loop->scan_start)
     {
+      rtx iteration_var = loop_info->iteration_var;
       struct loop_ivs *ivs = LOOP_IVS (loop);
-      struct iv_class *bl
-       = REG_IV_CLASS (ivs, REGNO (loop_info->iteration_var));
+      struct iv_class *bl;
 
-      if (INSN_LUID (bl->biv->insn) < INSN_LUID (loop->scan_start))
+      if (REG_IV_TYPE (ivs, REGNO (iteration_var)) == BASIC_INDUCT)
+       bl = REG_IV_CLASS (ivs, REGNO (iteration_var));
+      else if (REG_IV_TYPE (ivs, REGNO (iteration_var)) == GENERAL_INDUCT)
+       {
+         struct induction *v = REG_IV_INFO (ivs, REGNO (iteration_var));
+         bl = REG_IV_CLASS (ivs, REGNO (v->src_reg));
+       }
+      else
+       /* Iteration var must be an induction variable to get here.  */
+       abort();
+
+      if (INSN_UID (bl->biv->insn) < max_uid_for_loop
+         && INSN_LUID (bl->biv->insn) < INSN_LUID (loop->scan_start))
        {
          if (loop_dump_stream)
            fprintf (loop_dump_stream,