summaryrefslogtreecommitdiff
path: root/gcc/doloop.c
diff options
context:
space:
mode:
authorsirl <sirl@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-28 22:36:49 +0000
committersirl <sirl@138bc75d-0d04-0410-961f-82ee72b054a4>2000-09-28 22:36:49 +0000
commitac12d4a9c4fbca01c0af17776afec4f3a44c4f06 (patch)
tree5f38599624ea540c74f397af158e6f3f917cde0d /gcc/doloop.c
parent28ac6fa80eac8f5a2b94b9230673afeec807d826 (diff)
downloadgcc-ac12d4a9c4fbca01c0af17776afec4f3a44c4f06.tar.gz
2000-09-28 Franz Sirl <Franz.Sirl-kernel@lauterbach.com>
* doloop.c (doloop_modify): Prevent delete_insn() from deleting too much. Prefer loop->top over loop->start as target for the new JUMP insn. (doloop_valid_p): Ignore loop with exit_count != 0. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@36661 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doloop.c')
-rw-r--r--gcc/doloop.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/doloop.c b/gcc/doloop.c
index cb2b67bf49e..191cdf0cf37 100644
--- a/gcc/doloop.c
+++ b/gcc/doloop.c
@@ -281,7 +281,7 @@ doloop_valid_p (loop, jump_insn)
statement within a loop will generate multiple loop exits.
Another example of a loop that currently generates multiple exit
targets is for (i = 0; i < (foo ? 8 : 4); i++) { }. */
- if (loop_info->has_multiple_exit_targets)
+ if (loop_info->has_multiple_exit_targets || loop->exit_count)
{
if (loop_dump_stream)
fprintf (loop_dump_stream,
@@ -415,14 +415,16 @@ doloop_modify (loop, iterations, iterations_max,
fputs (" iterations).", loop_dump_stream);
}
+ /* Emit the label that will delimit the top of the loop.
+ This has to be done before the delete_insn call below, to prevent
+ delete_insn from deleting too much. */
+ emit_label_after (start_label, loop->top ? loop->top : loop->start);
+ LABEL_NUSES (start_label)++;
+
/* Discard original jump to continue loop. The original compare
result may still be live, so it cannot be discarded explicitly. */
delete_insn (jump_insn);
- /* Emit the label that will delimit the start of the loop. */
- emit_label_after (start_label, loop->start);
- LABEL_NUSES (start_label)++;
-
counter_reg = XEXP (condition, 0);
if (GET_CODE (counter_reg) == PLUS)
counter_reg = XEXP (counter_reg, 0);