]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
bfin.c (bfin_optimize_loop): If the LSETUP goes before a jump insn...
authorBernd Schmidt <bernd.schmidt@analog.com>
Wed, 25 Mar 2009 23:53:39 +0000 (23:53 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Wed, 25 Mar 2009 23:53:39 +0000 (23:53 +0000)
* config/bfin/bfin.c (bfin_optimize_loop): If the LSETUP goes before
a jump insn, count that jump in the distance to the loop start.

From-SVN: r145080

gcc/ChangeLog
gcc/config/bfin/bfin.c

index 7d9fe815e35bcd63eab2ad27e20d249c6510f948..1f525bfb35d4a33c0c858496c7b83d26234650fa 100644 (file)
@@ -1,3 +1,8 @@
+2009-03-26  Bernd Schmidt  <bernd.schmidt@analog.com>
+
+       * config/bfin/bfin.c (bfin_optimize_loop): If the LSETUP goes before
+       a jump insn, count that jump in the distance to the loop start.
+
 2009-03-25  Kaz Kojima  <kkojima@gcc.gnu.org>
 
        PR target/39523
index f4f9d45e3212648f8d368c76461eb4f5c39294ef..d1c964d02ea2145e5aa9801d483d0508e16896fb 100644 (file)
@@ -3854,9 +3854,17 @@ bfin_optimize_loop (loop_info loop)
       /* Make sure the predecessor is before the loop start label, as required by
         the LSETUP instruction.  */
       length = 0;
-      for (insn = BB_END (loop->incoming_src);
-          insn && insn != loop->start_label;
-          insn = NEXT_INSN (insn))
+      insn = BB_END (loop->incoming_src);
+      /* If we have to insert the LSETUP before a jump, count that jump in the
+        length.  */
+      if (VEC_length (edge, loop->incoming) > 1
+         || !(VEC_last (edge, loop->incoming)->flags & EDGE_FALLTHRU))
+       {
+         gcc_assert (JUMP_P (insn));
+         insn = PREV_INSN (insn);
+       }
+
+      for (; insn && insn != loop->start_label; insn = NEXT_INSN (insn))
        length += length_for_loop (insn);
       
       if (!insn)