summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorm.hayes <m.hayes@138bc75d-0d04-0410-961f-82ee72b054a4>1998-11-25 20:51:09 +0000
committerm.hayes <m.hayes@138bc75d-0d04-0410-961f-82ee72b054a4>1998-11-25 20:51:09 +0000
commit46134d72f4d6508e6e32f2ac153c19b03faf4e16 (patch)
tree0696cfb08feb8f43843cd461c5d10fbad1798b83
parent96a1254f7f624408e76dd3c0aadd8a7ea1afc044 (diff)
downloadgcc-46134d72f4d6508e6e32f2ac153c19b03faf4e16.tar.gz
* loop.c (check_dbra_loop): Update JUMP_LABEL field of jump insn
when loop reversed. * unroll.c (precondition_loop_p): Return loop_initial_value for initial_value instead of loop_iteration_var. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@23881 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/loop.c14
-rw-r--r--gcc/unroll.c23
3 files changed, 25 insertions, 20 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4118573b72d..d066040d2eb 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+Thu Nov 26 17:49:29 1998 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
+
+ * loop.c (check_dbra_loop): Update JUMP_LABEL field of jump insn
+ when loop reversed.
+
+ * unroll.c (precondition_loop_p): Return loop_initial_value
+ for initial_value instead of loop_iteration_var.
+
Thu Nov 26 17:15:38 1998 Michael Hayes <m.hayes@elec.canterbury.ac.nz>
* config/c4x/c4x.md: Fix minor formatting problems. Update docs.
diff --git a/gcc/loop.c b/gcc/loop.c
index b664e388047..4fb51988fbf 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -7107,16 +7107,18 @@ check_dbra_loop (loop_end, insn_count, loop_start)
end_sequence ();
emit_jump_insn_before (tem, loop_end);
+ for (tem = PREV_INSN (loop_end);
+ tem && GET_CODE (tem) != JUMP_INSN;
+ tem = PREV_INSN (tem))
+ ;
+
+ if (tem)
+ JUMP_LABEL (tem) = XEXP (jump_label, 0);
+
if (nonneg)
{
- for (tem = PREV_INSN (loop_end);
- tem && GET_CODE (tem) != JUMP_INSN;
- tem = PREV_INSN (tem))
- ;
if (tem)
{
- JUMP_LABEL (tem) = XEXP (jump_label, 0);
-
/* Increment of LABEL_NUSES done above. */
/* Register is now always nonnegative,
so add REG_NONNEG note to the branch. */
diff --git a/gcc/unroll.c b/gcc/unroll.c
index 034fe52a0e9..9bf6a514c2a 100644
--- a/gcc/unroll.c
+++ b/gcc/unroll.c
@@ -1410,19 +1410,6 @@ precondition_loop_p (initial_value, final_value, increment, loop_start)
return 0;
}
- /* Now set initial_value to be the iteration_var, since that may be a
- simpler expression, and is guaranteed to be correct if all of the
- above tests succeed.
-
- We can not use the initial_value as calculated, because it will be
- one too small for loops of the form "while (i-- > 0)". We can not
- emit code before the loop_skip_over insns to fix this problem as this
- will then give a number one too large for loops of the form
- "while (--i > 0)".
-
- Note that all loops that reach here are entered at the top, because
- this function is not called if the loop starts with a jump. */
-
/* Fail if loop_iteration_var is not live before loop_start, since we need
to test its value in the preconditioning code. */
@@ -1435,7 +1422,15 @@ precondition_loop_p (initial_value, final_value, increment, loop_start)
return 0;
}
- *initial_value = loop_iteration_var;
+ /* ??? Note that if iteration_info is modifed to allow GIV iterators
+ such as "while (i-- > 0)", the initial value will be one too small.
+ In this case, loop_iteration_var could be used to determine
+ the correct initial value, provided the loop has not been reversed.
+
+ Also note that the absolute values of initial_value and
+ final_value are unimportant as only their difference is used for
+ calculating the number of loop iterations. */
+ *initial_value = loop_initial_value;
*increment = loop_increment;
*final_value = loop_final_value;