diff options
author | Jim Wilson <wilson@cygnus.com> | 1998-04-07 12:00:13 +0000 |
---|---|---|
committer | Jim Wilson <wilson@gcc.gnu.org> | 1998-04-07 05:00:13 -0700 |
commit | 668d07befc13d7c751f0b3266eed899766c8f709 (patch) | |
tree | 097a5f58a110cf49bf93bd68109e7ea43318ed76 /gcc/loop.c | |
parent | a59ca936781f83a822e57f0a4ad4d6b8052139e0 (diff) | |
download | gcc-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/loop.c')
-rw-r--r-- | gcc/loop.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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 |