aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-09-19 16:04:01 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-09-19 16:04:01 +0000
commit3b10cf4be76c929ba27a62c3dfd70b8017155635 (patch)
tree07f4f7a539e15cea1a65dc0b43285692ada2a516 /gcc/loop.c
parent47d7090eeb4503fa6123cf1089a560b6379bff56 (diff)
downloadgcc-3b10cf4be76c929ba27a62c3dfd70b8017155635.zip
gcc-3b10cf4be76c929ba27a62c3dfd70b8017155635.tar.gz
gcc-3b10cf4be76c929ba27a62c3dfd70b8017155635.tar.bz2
rtl.h (insns_safe_to_move_p): New function.
* rtl.h (insns_safe_to_move_p): New function. * loop.c (find_and_verify_loops): Use it. * rtlanal.c (insns_safe_to_move_p): Define it. From-SVN: r29509
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index dcff685..cc278dc 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -2779,6 +2779,7 @@ find_and_verify_loops (f)
{
rtx p;
rtx our_next = next_real_insn (insn);
+ rtx last_insn_to_move = NEXT_INSN (insn);
int dest_loop;
int outer_loop = -1;
@@ -2830,7 +2831,11 @@ find_and_verify_loops (f)
&& INSN_UID (JUMP_LABEL (p)) != 0
&& condjump_p (p)
&& ! simplejump_p (p)
- && next_real_insn (JUMP_LABEL (p)) == our_next)
+ && next_real_insn (JUMP_LABEL (p)) == our_next
+ /* If it's not safe to move the sequence, then we
+ mustn't try. */
+ && insns_safe_to_move_p (p, NEXT_INSN (insn),
+ &last_insn_to_move))
{
rtx target
= JUMP_LABEL (insn) ? JUMP_LABEL (insn) : get_last_insn ();
@@ -2885,11 +2890,13 @@ find_and_verify_loops (f)
/* Include the BARRIER after INSN and copy the
block after LOC. */
- new_label = squeeze_notes (new_label, NEXT_INSN (insn));
- reorder_insns (new_label, NEXT_INSN (insn), loc);
+ new_label = squeeze_notes (new_label,
+ last_insn_to_move);
+ reorder_insns (new_label, last_insn_to_move, loc);
/* All those insns are now in TARGET_LOOP_NUM. */
- for (q = new_label; q != NEXT_INSN (NEXT_INSN (insn));
+ for (q = new_label;
+ q != NEXT_INSN (last_insn_to_move);
q = NEXT_INSN (q))
uid_loop_num[INSN_UID (q)] = target_loop_num;