summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-sccvn.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-18 15:27:21 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2008-09-18 15:27:21 +0000
commit9a7beb5fca4286c28b28d14fae2fa9584a2bf07b (patch)
treed5d3ac4757be317024a8c7493c7dd505ed3ca0bf /gcc/tree-ssa-sccvn.c
parent78fa9ba7f63d3c9ea10d354dc38aad11a2965704 (diff)
downloadgcc-9a7beb5fca4286c28b28d14fae2fa9584a2bf07b.tar.gz
2008-09-18 Richard Guenther <rguenther@suse.de>
PR tree-optimization/37258 * tree-ssa-sccvn.c (vn_phi_compute_hash): Include the precision and signedness for integral types. (vn_phi_eq): Require compatible types. * gcc.c-torture/compile/pr37258.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@140460 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r--gcc/tree-ssa-sccvn.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c
index 09b2ee8fffd..dbffff5aa2b 100644
--- a/gcc/tree-ssa-sccvn.c
+++ b/gcc/tree-ssa-sccvn.c
@@ -1402,9 +1402,17 @@ vn_phi_compute_hash (vn_phi_t vp1)
hashval_t result = 0;
int i;
tree phi1op;
+ tree type;
result = vp1->block->index;
+ /* If all PHI arguments are constants we need to distinguish
+ the PHI node via its type. */
+ type = TREE_TYPE (VEC_index (tree, vp1->phiargs, 0));
+ result += (INTEGRAL_TYPE_P (type)
+ + (INTEGRAL_TYPE_P (type)
+ ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0));
+
for (i = 0; VEC_iterate (tree, vp1->phiargs, i, phi1op); i++)
{
if (phi1op == VN_TOP)
@@ -1437,6 +1445,12 @@ vn_phi_eq (const void *p1, const void *p2)
int i;
tree phi1op;
+ /* If the PHI nodes do not have compatible types
+ they are not the same. */
+ if (!types_compatible_p (TREE_TYPE (VEC_index (tree, vp1->phiargs, 0)),
+ TREE_TYPE (VEC_index (tree, vp2->phiargs, 0))))
+ return false;
+
/* Any phi in the same block will have it's arguments in the
same edge order, because of how we store phi nodes. */
for (i = 0; VEC_iterate (tree, vp1->phiargs, i, phi1op); i++)