rtlanal.c (insn_first_p): Fix return value for insn == reference.
authorJ"orn Rennecke <amylaar@cygnus.co.uk>
Fri, 19 Feb 1999 14:49:59 +0000 (14:49 +0000)
committerJoern Rennecke <amylaar@gcc.gnu.org>
Fri, 19 Feb 1999 14:49:59 +0000 (14:49 +0000)
* rtlanal.c (insn_first_p): Fix return value for insn == reference.
* loop.c (strength_reduce, check_final_value, check_dbra_loop):
Use loop_insn_first_p.

From-SVN: r25321

gcc/ChangeLog
gcc/loop.c
gcc/rtlanal.c

index 55d621b25feddc248d445c6b325f739066daf6ee..a1946ef7246b7a711904853469f915eb591c3e55 100644 (file)
@@ -1,3 +1,10 @@
+Fri Feb 19 22:47:01 1999  J"orn Rennecke <amylaar@cygnus.co.uk>
+
+       * rtlanal.c (insn_first_p): Fix return value for insn == reference.
+
+       * loop.c (strength_reduce, check_final_value, check_dbra_loop):
+       Use loop_insn_first_p.
+
 Fri Feb 19 15:49:26 1999  Michael Meissner  <meissner@cygnus.com>
                          David Edelsohn  <edelsohn@mhpcc.edu>
 
index 43db725fc173f874cfe2184261516c565cbffd09..962736f9f6a9efcd2df1435fbd704a933e80f41d 100644 (file)
@@ -3784,13 +3784,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
                  && (! condjump_p (insn)
                      || (JUMP_LABEL (insn) != 0
                          && JUMP_LABEL (insn) != scan_start
-                         && (INSN_UID (JUMP_LABEL (insn)) >= max_uid_for_loop
-                             || (INSN_UID (p) < max_uid_for_loop
-                                 ? (INSN_LUID (JUMP_LABEL (insn))
-                                    <= INSN_LUID (p))
-                                 : (INSN_UID (insn) >= max_uid_for_loop
-                                    || (INSN_LUID (JUMP_LABEL (insn))
-                                        < INSN_LUID (insn))))))))
+                         && ! loop_insn_first_p (p, JUMP_LABEL (insn)))))
                {
                  maybe_multiple = 1;
                  break;
@@ -3856,7 +3850,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
 
       if (not_every_iteration && GET_CODE (p) == CODE_LABEL
          && no_labels_between_p (p, loop_end)
-         && insn_first_p (p, loop_cont))
+         && loop_insn_first_p (p, loop_cont))
        not_every_iteration = 0;
     }
 
@@ -4031,7 +4025,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
                 in-between when biv_toal_increment returns nonzero both times
                 but we test it here in case some day some real cfg analysis
                 gets used to set always_computable.  */
-             && ((insn_first_p (bl2->biv->insn, bl->biv->insn)
+             && ((loop_insn_first_p (bl2->biv->insn, bl->biv->insn)
                   && no_labels_between_p (bl2->biv->insn, bl->biv->insn))
                  || (! reg_used_between_p (bl->biv->src_reg, bl->biv->insn,
                                            bl2->biv->insn)
@@ -4090,7 +4084,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
                      && ! reg_used_between_p (giv, bl->init_insn, loop_start))
                    delete_insn (bl->init_insn);
                }
-             else if (! insn_first_p (bl2->biv->insn, bl->biv->insn))
+             else if (! loop_insn_first_p (bl2->biv->insn, bl->biv->insn))
                {
                  rtx p = PREV_INSN (giv_insn);
                  while (INSN_UID (p) >= max_uid_for_loop)
@@ -4453,7 +4447,7 @@ strength_reduce (scan_start, end, loop_top, insn_count,
 
       if (not_every_iteration && GET_CODE (p) == CODE_LABEL
          && no_labels_between_p (p, loop_end)
-         && insn_first_p (p, loop_cont))
+         && loop_insn_first_p (p, loop_cont))
        not_every_iteration = 0;
     }
 
@@ -5664,13 +5658,10 @@ check_final_value (v, loop_start, loop_end, n_iterations)
 
              if (GET_CODE (p) == JUMP_INSN && JUMP_LABEL (p)
                  && LABEL_NAME (JUMP_LABEL (p))
-                 && ((INSN_UID (JUMP_LABEL (p)) >= max_uid_for_loop)
-                     || (INSN_UID (v->insn) >= max_uid_for_loop)
-                     || (INSN_UID (last_giv_use) >= max_uid_for_loop)
-                     || (INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (v->insn)
-                         && INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (loop_start))
-                     || (INSN_LUID (JUMP_LABEL (p)) > INSN_LUID (last_giv_use)
-                         && INSN_LUID (JUMP_LABEL (p)) < INSN_LUID (loop_end))))
+                 && ((loop_insn_first_p (JUMP_LABEL (p), v->insn)
+                      && loop_insn_first_p (loop_start, JUMP_LABEL (p)))
+                     || (loop_insn_first_p (last_giv_use, JUMP_LABEL (p))
+                         && loop_insn_first_p (JUMP_LABEL (p), loop_end))))
                {
                  v->replaceable = 0;
                  v->not_replaceable = 1;
@@ -7749,9 +7740,7 @@ check_dbra_loop (loop_end, insn_count, loop_start, loop_info)
                  if (v->giv_type == DEST_REG
                      && reg_mentioned_p (v->dest_reg,
                                          XEXP (loop_store_mems, 0))
-                     && (INSN_UID (v->insn) >= max_uid_for_loop
-                         || (INSN_LUID (v->insn)
-                             > INSN_LUID (first_loop_store_insn))))
+                     && loop_insn_first_p (first_loop_store_insn, v->insn))
                    reversible_mem_store = 0;
                }
            }
index ffaad23769e57a7734913055ae965e2c68b38f8b..41744d747a2a920312015329b41624f1b10a483f 100644 (file)
@@ -2212,10 +2212,12 @@ insn_first_p (insn, reference)
 
   for (p = insn, q = reference; ; p = NEXT_INSN (p), q = NEXT_INSN (q))
     {
-      if (p == reference || ! q)
-       return 1;
+      /* Start with test for not first so that INSN == REFERENCE yields not
+        first.  */
       if (q == insn || ! p)
        return 0;
+      if (p == reference || ! q)
+       return 1;
     }
 }