OSDN Git Service

2006-06-19 Anatoly Sokolov <aesok@post.ru>
[pf3gnuchains/gcc-fork.git] / gcc / loop-unroll.c
index 6ef5947..156f688 100644 (file)
@@ -233,22 +233,15 @@ loop_exit_at_end_p (struct loop *loop)
 static void
 peel_loops_completely (struct loops *loops, int flags)
 {
-  struct loop *loop, *next;
-
-  loop = loops->tree_root;
-  while (loop->inner)
-    loop = loop->inner;
+  struct loop *loop;
+  unsigned i;
 
-  while (loop != loops->tree_root)
+  /* Scan the loops, the inner ones first.  */
+  for (i = loops->num - 1; i > 0; i--)
     {
-      if (loop->next)
-       {
-         next = loop->next;
-         while (next->inner)
-           next = next->inner;
-       }
-      else
-       next = loop->outer;
+      loop = loops->parray[i];
+      if (!loop)
+       continue;
 
       loop->lpt_decision.decision = LPT_NONE;
 
@@ -271,7 +264,6 @@ peel_loops_completely (struct loops *loops, int flags)
          verify_loop_structure (loops);
 #endif
        }
-      loop = next;
     }
 }
 
@@ -1670,7 +1662,17 @@ analyze_iv_to_split_insn (rtx insn)
     return NULL;
 
   ok = iv_analyze_result (insn, dest, &iv);
-  gcc_assert (ok);
+
+  /* This used to be an assert under the assumption that if biv_p returns
+     true that iv_analyze_result must also return true.  However, that
+     assumption is not strictly correct as evidenced by pr25569.
+
+     Returning NULL when iv_analyze_result returns false is safe and
+     avoids the problems in pr25569 until the iv_analyze_* routines
+     can be fixed, which is apparently hard and time consuming
+     according to their author.  */
+  if (! ok)
+    return NULL;
 
   if (iv.step == const0_rtx
       || iv.mode != iv.extend_mode)