aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1997-02-20 13:43:33 -0800
committerJim Wilson <wilson@gcc.gnu.org>1997-02-20 13:43:33 -0800
commit9290558260c3d26ae55adb61a7225dde9e61fb79 (patch)
treea91260ab5d148a7022550e1ab143c93a81bd3918
parent7657bf2fbfd58cc2b4926c32b0d0fe96ec186f57 (diff)
downloadgcc-9290558260c3d26ae55adb61a7225dde9e61fb79.zip
gcc-9290558260c3d26ae55adb61a7225dde9e61fb79.tar.gz
gcc-9290558260c3d26ae55adb61a7225dde9e61fb79.tar.bz2
(unroll_loop): Add check for naive loop that ends with
conditional branch that does not branch back to loop start. From-SVN: r13672
-rw-r--r--gcc/unroll.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 0e033ef..2ab6b2a 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -637,6 +637,23 @@ unroll_loop (loop_end, insn_count, loop_start, end_insert_before,
copy_end = last_loop_insn;
}
+ if (unroll_type == UNROLL_NAIVE
+ && GET_CODE (last_loop_insn) == JUMP_INSN
+ && start_label != JUMP_LABEL (last_loop_insn))
+ {
+ /* ??? The loop ends with a conditional branch that does not branch back
+ to the loop start label. In this case, we must emit an unconditional
+ branch to the loop exit after emitting the final branch.
+ copy_loop_body does not have support for this currently, so we
+ give up. It doesn't seem worthwhile to unroll anyways since
+ unrolling would increase the number of branch instructions
+ executed. */
+ if (loop_dump_stream)
+ fprintf (loop_dump_stream,
+ "Unrolling failure: final conditional branch not to loop start\n");
+ return;
+ }
+
/* Allocate a translation table for the labels and insn numbers.
They will be filled in as we copy the insns in the loop. */