aboutsummaryrefslogtreecommitdiff
path: root/gcc/loop.c
diff options
context:
space:
mode:
authorJ"orn Rennecke <amylaar@cygnus.co.uk>2000-05-25 01:30:51 +0000
committerJoern Rennecke <amylaar@gcc.gnu.org>2000-05-25 02:30:51 +0100
commitaf1980974939d286cf7d8341a902c0824a52ad0e (patch)
tree23deba3bdcf72e5708b166a15f5e267fa74780b2 /gcc/loop.c
parent73bb94549e0777fbd981ad68745efa6c0715f0c5 (diff)
downloadgcc-af1980974939d286cf7d8341a902c0824a52ad0e.zip
gcc-af1980974939d286cf7d8341a902c0824a52ad0e.tar.gz
gcc-af1980974939d286cf7d8341a902c0824a52ad0e.tar.bz2
* loop.c (basic_induction_var): Avoid double recording of an increment.
From-SVN: r34153
Diffstat (limited to 'gcc/loop.c')
-rw-r--r--gcc/loop.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/loop.c b/gcc/loop.c
index ed396f4..6746c98 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -5995,6 +5995,11 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location)
/* If this register is assigned in a previous insn, look at its
source, but don't go outside the loop or past a label. */
+ /* If this sets a register to itself, we would repeat any previous
+ biv increment if we applied this strategy blindly. */
+ if (rtx_equal_p (dest_reg, x))
+ return 0;
+
insn = p;
while (1)
{
@@ -6066,7 +6071,8 @@ basic_induction_var (loop, x, mode, dest_reg, p, inc_val, mult_val, location)
if (insn)
set = single_set (insn);
- if (set && SET_DEST (set) == XEXP (x, 0)
+ if (! rtx_equal_p (dest_reg, XEXP (x, 0))
+ && set && SET_DEST (set) == XEXP (x, 0)
&& GET_CODE (XEXP (x, 1)) == CONST_INT
&& INTVAL (XEXP (x, 1)) >= 0
&& GET_CODE (SET_SRC (set)) == ASHIFT