Permit doloop treatment for preconditioned loops.
authorDale Johannesen <dalej@apple.com>
Mon, 7 Oct 2002 17:55:46 +0000 (17:55 +0000)
committerDale Johannesen <dalej@gcc.gnu.org>
Mon, 7 Oct 2002 17:55:46 +0000 (17:55 +0000)
From-SVN: r57902

gcc/ChangeLog
gcc/doloop.c
gcc/loop.c
gcc/rtl.h
gcc/unroll.c

index 13f3151..adffbeb 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-07  Dale Johannesen  <dalej@apple.com>
+       * rtl.h:  Add NOTE_PRECONDITIONED.
+       * unroll.c:  Set it.
+       * loop.c:  Set loop_info->preconditioned from it.
+       * doloop.c:  Permit doloop treatment when loop_info->preconditoned.
+
 2002-10-07  Richard Henderson  <rth@redhat.com>
 
        * config/i960/i960.c (i960_setup_incoming_varargs): Create a
index 3e1c7b1..1f7d47a 100644 (file)
@@ -339,6 +339,7 @@ doloop_valid_p (loop, jump_insn)
      condition at run-time and have an additional jump around the loop
      to ensure an infinite loop.  */
   if (loop_info->comparison_code == NE
+      && !loop_info->preconditioned
       && INTVAL (loop_info->increment) != -1
       && INTVAL (loop_info->increment) != 1)
     {
index 0a7fa9b..5db9677 100644 (file)
@@ -2475,7 +2475,8 @@ prescan_loop (loop)
   loop_info->first_loop_store_insn = NULL_RTX;
   loop_info->mems_idx = 0;
   loop_info->num_mem_sets = 0;
-
+  /* If loop opts run twice, this was set on 1st pass for 2nd. */
+  loop_info->preconditioned = NOTE_PRECONDITIONED (end);
 
   for (insn = start; insn && GET_CODE (insn) != CODE_LABEL;
        insn = PREV_INSN (insn))
index d4147c2..9aada82 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -787,6 +787,7 @@ extern const char * const reg_note_name[];
 #define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 4, NOTE)
 #define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE)
 #define NOTE_PREDICTION(INSN)   XCINT (INSN, 4, NOTE)
+#define NOTE_PRECONDITIONED(INSN)   XCINT (INSN, 4, NOTE)
 
 /* In a NOTE that is a line number, this is the line number.
    Other kinds of NOTEs are identified by negative numbers here.  */
index 3e5ea7f..fa04253 100644 (file)
@@ -1136,6 +1136,9 @@ unroll_loop (loop, insn_count, strength_reduce_p)
   /* And whether the loop has been preconditioned.  */
   loop_info->preconditioned = loop_preconditioned;
 
+  /* Remember whether it was preconditioned for the second loop pass. */
+  NOTE_PRECONDITIONED (loop->end) = loop_preconditioned;
+
   /* For each biv and giv, determine whether it can be safely split into
      a different variable for each unrolled copy of the loop body.
      We precalculate and save this info here, since computing it is