diff options
author | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-07 12:00:13 +0000 |
---|---|---|
committer | wilson <wilson@138bc75d-0d04-0410-961f-82ee72b054a4> | 1998-04-07 12:00:13 +0000 |
commit | c8e5b8a3518de267e3c6b9f6e022e57f18c15481 (patch) | |
tree | 097a5f58a110cf49bf93bd68109e7ea43318ed76 /gcc/loop.c | |
parent | 2af98c0dd462339634f41aec9700ba8f8d35f12e (diff) | |
download | gcc-c8e5b8a3518de267e3c6b9f6e022e57f18c15481.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@19030 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/loop.c')
-rw-r--r-- | gcc/loop.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/loop.c b/gcc/loop.c index d46ca648834..a3f7a8f59bc 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 |