diff options
author | Roger Sayle <roger@eyesopen.com> | 2006-09-12 16:02:31 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2006-09-12 16:02:31 +0000 |
commit | 4c6669c2c69920d414e0dd3933c265c5382a4da3 (patch) | |
tree | 380b55458f139310bb54f4f1242f9da985b452e8 /gcc | |
parent | 4b943588d131d6fa709b89903c920b726a85df82 (diff) | |
download | gcc-4c6669c2c69920d414e0dd3933c265c5382a4da3.zip gcc-4c6669c2c69920d414e0dd3933c265c5382a4da3.tar.gz gcc-4c6669c2c69920d414e0dd3933c265c5382a4da3.tar.bz2 |
re PR middle-end/4520 (cselib.c hash_rtx incorrectly hashes based on rtx address)
PR middle-end/4520
PR bootstrap/28784
* cselib.c (cselib_hash_rtx): Avoid hashing on the address of labels
and symbols. Instead use the implementation from cse.c's hash_rtx.
From-SVN: r116891
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cselib.c | 24 |
2 files changed, 26 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d66902..0a0d31b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2006-09-12 Roger Sayle <roger@eyesopen.com> + + PR middle-end/4520 + PR bootstrap/28784 + * cselib.c (cselib_hash_rtx): Avoid hashing on the address of labels + and symbols. Instead use the implementation from cse.c's hash_rtx. + 2006-09-12 Jan Hubicka <jh@suse.cz> PR rtl-optimization/28071 diff --git a/gcc/cselib.c b/gcc/cselib.c index edfc328..4070da7 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -630,14 +630,28 @@ cselib_hash_rtx (rtx x, int create) /* Assume there is only one rtx object for any given label. */ case LABEL_REF: - hash - += ((unsigned) LABEL_REF << 7) + (unsigned long) XEXP (x, 0); + /* We don't hash on the address of the CODE_LABEL to avoid bootstrap + differences and differences between each stage's debugging dumps. */ + hash += (((unsigned int) LABEL_REF << 7) + + CODE_LABEL_NUMBER (XEXP (x, 0))); return hash ? hash : (unsigned int) LABEL_REF; case SYMBOL_REF: - hash - += ((unsigned) SYMBOL_REF << 7) + (unsigned long) XSTR (x, 0); - return hash ? hash : (unsigned int) SYMBOL_REF; + { + /* Don't hash on the symbol's address to avoid bootstrap differences. + Different hash values may cause expressions to be recorded in + different orders and thus different registers to be used in the + final assembler. This also avoids differences in the dump files + between various stages. */ + unsigned int h = 0; + const unsigned char *p = (const unsigned char *) XSTR (x, 0); + + while (*p) + h += (h << 7) + *p++; /* ??? revisit */ + + hash += ((unsigned int) SYMBOL_REF << 7) + h; + return hash ? hash : (unsigned int) SYMBOL_REF; + } case PRE_DEC: case PRE_INC: |