aboutsummaryrefslogtreecommitdiff
path: root/gcc/emit-rtl.c
diff options
context:
space:
mode:
authorSteven Bosscher <stevenb.gcc@gmail.com>2006-01-03 06:20:21 +0000
committerSteven Bosscher <steven@gcc.gnu.org>2006-01-03 06:20:21 +0000
commit78b76d0884d435c6e05d023db71a8b00c0f044b2 (patch)
tree0f27e072946d5679715a3b35a103656388cb972e /gcc/emit-rtl.c
parent0884546e1b92fe109e30cca3295e6212e4b24567 (diff)
downloadgcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.zip
gcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.tar.gz
gcc-78b76d0884d435c6e05d023db71a8b00c0f044b2.tar.bz2
re PR rtl-optimization/25130 (miscompilation in GCSE)
* fold-const.c (operand_equal_p): Accept a NULL operand 0 for COMPONENT_REFs. * emit-rtl.c (mem_attrs_htab_eq): Use iterative_hash_expr for hashing trees instead of a pointer hash. (mem_attrs_htab_eq): Do a deep compare instead of a pointer compare for MEM_EXPR. PR rtl-optimization/25130 * cse.c (exp_equiv_p): Compare MEM_ATTRS instead of MEM_ALIAS_SET when comparing MEMs for GCSE From-SVN: r109264
Diffstat (limited to 'gcc/emit-rtl.c')
-rw-r--r--gcc/emit-rtl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c
index 8286510..aaab19e 100644
--- a/gcc/emit-rtl.c
+++ b/gcc/emit-rtl.c
@@ -254,7 +254,7 @@ mem_attrs_htab_hash (const void *x)
return (p->alias ^ (p->align * 1000)
^ ((p->offset ? INTVAL (p->offset) : 0) * 50000)
^ ((p->size ? INTVAL (p->size) : 0) * 2500000)
- ^ (size_t) p->expr);
+ ^ (size_t) iterative_hash_expr (p->expr, 0));
}
/* Returns nonzero if the value represented by X (which is really a
@@ -267,8 +267,11 @@ mem_attrs_htab_eq (const void *x, const void *y)
mem_attrs *p = (mem_attrs *) x;
mem_attrs *q = (mem_attrs *) y;
- return (p->alias == q->alias && p->expr == q->expr && p->offset == q->offset
- && p->size == q->size && p->align == q->align);
+ return (p->alias == q->alias && p->offset == q->offset
+ && p->size == q->size && p->align == q->align
+ && (p->expr == q->expr
+ || (p->expr != NULL_TREE && q->expr != NULL_TREE
+ && operand_equal_p (p->expr, q->expr, 0))));
}
/* Allocate a new mem_attrs structure and insert it into the hash table if