aboutsummaryrefslogtreecommitdiff
path: root/gcc/doloop.c
diff options
context:
space:
mode:
authorFranz Sirl <Franz.Sirl-kernel@lauterbach.com>2000-09-28 22:36:49 +0000
committerFranz Sirl <sirl@gcc.gnu.org>2000-09-28 22:36:49 +0000
commit1db88ef97966a671405ab7d165e1b11fa1e2bc61 (patch)
tree5f38599624ea540c74f397af158e6f3f917cde0d /gcc/doloop.c
parent2eeb109b26058137a84566db3af8f8c883efa06c (diff)
downloadgcc-1db88ef97966a671405ab7d165e1b11fa1e2bc61.zip
gcc-1db88ef97966a671405ab7d165e1b11fa1e2bc61.tar.gz
gcc-1db88ef97966a671405ab7d165e1b11fa1e2bc61.tar.bz2
doloop.c (doloop_modify): Prevent delete_insn() from deleting too much.
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. From-SVN: r36661
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 cb2b67b..191cdf0 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);