summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2008-09-18 15:27:21 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2008-09-18 15:27:21 +0000
commit1d295886287812ee7e5b5bfc63ff598a2a9e9958 (patch)
treed5d3ac4757be317024a8c7493c7dd505ed3ca0bf /gcc
parent802e9f8e7ccb805437419eef74a9a1cbe75a68ed (diff)
downloadgcc-1d295886287812ee7e5b5bfc63ff598a2a9e9958.tar.gz
re PR tree-optimization/37258 (ice in simplify_subreg, at simplify-rtx.c:4957)
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. From-SVN: r140460
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/pr37258.c58
-rw-r--r--gcc/tree-ssa-sccvn.c14
4 files changed, 84 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 4a6370563ba..9f9ddde9d9c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+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.
+
2008-09-18 Jakub Jelinek <jakub@redhat.com>
PR debug/34037
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 72e590c34c6..e8d98466b8f 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2008-09-18 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/37258
+ * gcc.c-torture/compile/pr37258.c: New testcase.
+
2008-09-18 Andrew MacLeod <amacleod@redhat.com>
PR tree-optimization/37102
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr37258.c b/gcc/testsuite/gcc.c-torture/compile/pr37258.c
new file mode 100644
index 00000000000..5091d980bfd
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/pr37258.c
@@ -0,0 +1,58 @@
+typedef signed char int8_t;
+typedef short int int16_t;
+typedef int int32_t;
+__extension__ typedef long long int int64_t;
+typedef unsigned short int uint16_t;
+typedef unsigned int uint32_t;
+static inline unsigned int
+lshift_u_s (unsigned int left, int right)
+{
+ if ((right) || (right >= sizeof (unsigned int) * 8)
+ || (left > (4294967295U >> right)))
+ return left;
+}
+static inline unsigned long int
+div_rhs (long int rhs)
+{
+ if (rhs == 0)
+ return 1;
+ return rhs;
+}
+
+uint32_t g_230;
+int8_t g_294;
+uint16_t g_316;
+uint32_t g_334;
+int32_t g_375;
+int64_t g_380;
+int32_t func_99 (int16_t p_100, int32_t p_101, int32_t p_102, int32_t p_103,
+ int64_t p_105, int32_t p_106, int32_t p_107, int16_t p_108,
+ int16_t p_109);
+int32_t
+func_77 (int64_t p_79)
+{
+ int16_t l_397;
+ if (mod_rhs (p_79))
+ p_79 = 1;
+ else
+ for (p_79 = 0; 0; p_79 += 1)
+ {
+ }
+ if (lshift_s_s (1, func_112 (2L, (lshift_u_s (g_334, p_79)))))
+ {
+ int8_t l_384;
+ int64_t l_414;
+ if (lshift_u_s (g_375, 1))
+ {
+ func_23 (func_99 (1, 1, 1, 1, g_230, p_79, 1, g_334, 1), 1);
+ for (p_79 = 0; 0; ++p_79)
+ {
+ }
+ }
+ if (div_rhs (func_82 (1, 1, g_380, 1, l_397, 1, 1)))
+ func_99 ((func_82
+ (1, g_334, g_294, func_112 (1, (p_79 & 1)), g_316, 1, 1)),
+ 1, (0xFBA25CA382A8CA74LL), l_384, l_414, 0L, 1, 1, 1);
+ }
+}
+
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++)