From: Bernd Schmidt Date: Wed, 25 Mar 2009 23:53:39 +0000 (+0000) Subject: bfin.c (bfin_optimize_loop): If the LSETUP goes before a jump insn... X-Git-Tag: releases/gcc-4.4.0~172 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=03f8829b50afa18835aa63de08232247f09289a8;p=thirdparty%2Fgcc.git bfin.c (bfin_optimize_loop): If the LSETUP goes before a jump insn... * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7d9fe815e35b..1f525bfb35d4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2009-03-26 Bernd Schmidt + + * 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 PR target/39523 diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c index f4f9d45e3212..d1c964d02ea2 100644 --- a/gcc/config/bfin/bfin.c +++ b/gcc/config/bfin/bfin.c @@ -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)