aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@cygnus.com>1998-04-07 12:00:13 +0000
committerJim Wilson <wilson@gcc.gnu.org>1998-04-07 05:00:13 -0700
commit668d07befc13d7c751f0b3266eed899766c8f709 (patch)
tree097a5f58a110cf49bf93bd68109e7ea43318ed76 /gcc
parenta59ca936781f83a822e57f0a4ad4d6b8052139e0 (diff)
downloadgcc-668d07befc13d7c751f0b3266eed899766c8f709.zip
gcc-668d07befc13d7c751f0b3266eed899766c8f709.tar.gz
gcc-668d07befc13d7c751f0b3266eed899766c8f709.tar.bz2
Fix loop reversal bug reported by Joern Rennecke.
* loop.c (check_dbra_loop): When normalize comparison_val, add check to verify it is non-negative. From-SVN: r19030
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/loop.c5
2 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3f87f3f..58ec0ef 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Tue Apr 7 11:58:04 1998 Jim Wilson <wilson@cygnus.com>
+
+ * loop.c (check_dbra_loop): When normalize comparison_val, add check
+ to verify it is non-negative.
+
Tue Apr 7 02:01:47 1998 Richard Henderson <rth@cygnus.com>
* alpha.c (alpha_expand_block_move): Correctly collect block offsets.
diff --git a/gcc/loop.c b/gcc/loop.c
index d46ca64..a3f7a8f 100644
--- a/gcc/loop.c
+++ b/gcc/loop.c
@@ -6281,7 +6281,10 @@ check_dbra_loop (loop_end, insn_count, loop_start)
&& GET_CODE (initial_value) == CONST_INT)
{
comparison_val = comparison_val - INTVAL (bl->initial_value);
- initial_value = const0_rtx;
+ /* Check for overflow. If comparison_val ends up as a
+ negative value, then we can't reverse the loop. */
+ if (comparison_val >= 0)
+ initial_value = const0_rtx;
}
/* If the initial value is not zero, or if the comparison