unroll.c (loop_iterations): Extend check for multiple back edges.
authorFranz Sirl <Franz.Sirl-kernel@lauterbach.com>
Mon, 8 Oct 2001 21:20:43 +0000 (21:20 +0000)
committerFranz Sirl <sirl@gcc.gnu.org>
Mon, 8 Oct 2001 21:20:43 +0000 (21:20 +0000)
2001-10-08  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>

* unroll.c (loop_iterations): Extend check for multiple back edges.

From-SVN: r46099

gcc/ChangeLog
gcc/unroll.c

index f21ad78f8202aebf1772ef68d22522ae58923995..854f28ad12785cc456ef10fc7ed5175567594cce 100644 (file)
@@ -1,3 +1,7 @@
+2001-10-08  Franz Sirl  <Franz.Sirl-kernel@lauterbach.com>
+
+       * unroll.c (loop_iterations): Extend check for multiple back edges.
+
 2001-10-08  Alexandre Oliva  <aoliva@redhat.com>
 
        * langhooks.h: New file.
index c0fe373fdfbccc5f2ca98d61938b008e99bea6aa..a2af2137f052160ffcd23c0196ca57aea0717c8a 100644 (file)
@@ -3519,6 +3519,27 @@ loop_iterations (loop)
       return 0;
     }
 
+  /* If there are multiple conditionalized loop exit tests, they may jump
+     back to differing CODE_LABELs.  */
+  if (loop->top && loop->cont)
+    {
+      rtx temp = PREV_INSN (last_loop_insn);
+
+      do
+       {
+         if (GET_CODE (temp) == JUMP_INSN
+             && INSN_LUID (JUMP_LABEL (temp)) > INSN_LUID (loop->top)
+             && INSN_LUID (JUMP_LABEL (temp)) < INSN_LUID (loop->cont))
+           {
+             if (loop_dump_stream)
+               fprintf (loop_dump_stream,
+                        "Loop iterations: Loop has multiple back edges.\n");
+             return 0;
+           }
+       }
+      while ((temp = PREV_INSN (temp)) != loop->cont);
+    }
+
   /* Find the iteration variable.  If the last insn is a conditional
      branch, and the insn before tests a register value, make that the
      iteration variable.  */