diff options
author | J"orn Rennecke <amylaar@redhat.com> | 2001-01-05 20:42:30 +0000 |
---|---|---|
committer | Joern Rennecke <amylaar@gcc.gnu.org> | 2001-01-05 20:42:30 +0000 |
commit | 8b03b9843b8129d41b806a5e26f0da6142cc7468 (patch) | |
tree | 9a0f9a440b9459868686ca70d71720180e9365ad /gcc/cse.c | |
parent | 18a7c2a7a1fd3ef6f769e9374931103589197f1d (diff) | |
download | gcc-8b03b9843b8129d41b806a5e26f0da6142cc7468.zip gcc-8b03b9843b8129d41b806a5e26f0da6142cc7468.tar.gz gcc-8b03b9843b8129d41b806a5e26f0da6142cc7468.tar.bz2 |
cse.c (find_comparison_args): Stop if the argument is known to be constant.
* cse.c (find_comparison_args): Stop if the argument is known to
be constant.
From-SVN: r38723
Diffstat (limited to 'gcc/cse.c')
-rw-r--r-- | gcc/cse.c | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -3161,7 +3161,20 @@ find_comparison_args (code, parg1, parg2, pmode1, pmode2) p = lookup (arg1, safe_hash (arg1, GET_MODE (arg1)) & HASH_MASK, GET_MODE (arg1)); if (p) - p = p->first_same_value; + { + p = p->first_same_value; + + /* If what we compare is already known to be constant, that is as + good as it gets. + We need to break the loop in this case, because otherwise we + can have an infinite loop when looking at a reg that is known + to be a constant which is the same as a comparison of a reg + against zero which appears later in the insn stream, which in + turn is constant and the same as the comparison of the first reg + against zero... */ + if (p->is_const) + break; + } for (; p; p = p->next_same_value) { |