summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-05 20:42:30 +0000
committeramylaar <amylaar@138bc75d-0d04-0410-961f-82ee72b054a4>2001-01-05 20:42:30 +0000
commite9a91a9e03c2a46cd9c39b6d5e7a474d34afbb27 (patch)
tree9a0f9a440b9459868686ca70d71720180e9365ad
parent60cb217d0a5f389aff93d2cfa3fc75a3e18d2f9d (diff)
downloadppe42-gcc-e9a91a9e03c2a46cd9c39b6d5e7a474d34afbb27.tar.gz
ppe42-gcc-e9a91a9e03c2a46cd9c39b6d5e7a474d34afbb27.zip
* cse.c (find_comparison_args): Stop if the argument is known to
be constant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38723 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/cse.c15
2 files changed, 19 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 95d38f2de6a..650faa7838f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Fri Jan 5 20:34:06 2001 J"orn Rennecke <amylaar@redhat.com>
+
+ * cse.c (find_comparison_args): Stop if the argument is known to
+ be constant.
+
2001-01-05 Alexandre Oliva <aoliva@redhat.com>
* config/sh/sh.md (movdf): When splitting load into pair of
diff --git a/gcc/cse.c b/gcc/cse.c
index f5c93530a35..8642550c512 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -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)
{
OpenPOWER on IntegriCloud