diff options
author | Richard Biener <rguenther@suse.de> | 2013-02-19 12:10:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2013-02-19 12:10:48 +0000 |
commit | 24d630163b15482845ffef8c733653281008016f (patch) | |
tree | 9b4aeec6f3f6f83ed0fdf40cc3955ca4432abfbf /gcc/tree-ssa-sccvn.c | |
parent | 47cc28f568eff9f93ad63ca2cb730b865232f441 (diff) | |
download | gcc-24d630163b15482845ffef8c733653281008016f.zip gcc-24d630163b15482845ffef8c733653281008016f.tar.gz gcc-24d630163b15482845ffef8c733653281008016f.tar.bz2 |
re PR tree-optimization/56384 (ICE in fold_binary_loc, at fold-const.c:10422)
2013-02-19 Richard Biener <rguenther@suse.de>
PR tree-optimization/56384
* tree-ssa-sccvn.h (struct vn_phi_s): Add type member.
(vn_hash_type): Split out from ...
(vn_hash_constant_with_type): ... here.
* tree-ssa-sccvn.c (vn_phi_compute_hash): Use vn_hash_type.
(vn_phi_eq): Compare types from vn_phi_s structure.
(vn_phi_lookup): Populate vn_phi_s type.
(vn_phi_insert): Likewise.
* gcc.dg/torture/pr56384.c: New testcase.
From-SVN: r196136
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 81a07ae..202980c 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -2401,10 +2401,8 @@ vn_phi_compute_hash (vn_phi_t vp1) /* If all PHI arguments are constants we need to distinguish the PHI node via its type. */ - type = TREE_TYPE (vp1->phiargs[0]); - result += (INTEGRAL_TYPE_P (type) - + (INTEGRAL_TYPE_P (type) - ? TYPE_PRECISION (type) + TYPE_UNSIGNED (type) : 0)); + type = vp1->type; + result += vn_hash_type (type); FOR_EACH_VEC_ELT (vp1->phiargs, i, phi1op) { @@ -2443,8 +2441,7 @@ vn_phi_eq (const void *p1, const void *p2) /* If the PHI nodes do not have compatible types they are not the same. */ - if (!types_compatible_p (TREE_TYPE (vp1->phiargs[0]), - TREE_TYPE (vp2->phiargs[0]))) + if (!types_compatible_p (vp1->type, vp2->type)) return false; /* Any phi in the same block will have it's arguments in the @@ -2484,6 +2481,7 @@ vn_phi_lookup (gimple phi) def = TREE_CODE (def) == SSA_NAME ? SSA_VAL (def) : def; shared_lookup_phiargs.safe_push (def); } + vp1.type = TREE_TYPE (gimple_phi_result (phi)); vp1.phiargs = shared_lookup_phiargs; vp1.block = gimple_bb (phi); vp1.hashcode = vn_phi_compute_hash (&vp1); @@ -2516,6 +2514,7 @@ vn_phi_insert (gimple phi, tree result) args.safe_push (def); } vp1->value_id = VN_INFO (result)->value_id; + vp1->type = TREE_TYPE (gimple_phi_result (phi)); vp1->phiargs = args; vp1->block = gimple_bb (phi); vp1->result = result; |