aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-04-19 21:16:18 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2018-04-19 21:16:18 +0200
commit18108d94e9aff71811a7923fe67db7626378f565 (patch)
treeddd35d8dcd17acb5ddfc2bf7b8105dbe62222911
parentf62a0ddd737a3faa3925ae211bd22fa8ca62c112 (diff)
downloadgcc-18108d94e9aff71811a7923fe67db7626378f565.zip
gcc-18108d94e9aff71811a7923fe67db7626378f565.tar.gz
gcc-18108d94e9aff71811a7923fe67db7626378f565.tar.bz2
re PR tree-optimization/85467 (ICE: verify_gimple failed: non-trivial conversion at assignment with -O2 -fno-tree-ccp --param=sccvn-max-scc-size=10)
PR tree-optimization/85467 * fold-const.c (fold_ternary_loc) <case BIT_FIELD_REF>: Use VECTOR_TYPE_P macro. If type is vector type, VIEW_CONVERT_EXPR the VECTOR_CST element to type. * gcc.dg/pr85467.c: New test. From-SVN: r259507
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c9
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/pr85467.c30
4 files changed, 49 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6d676a1..d51da37 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2018-04-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85467
+ * fold-const.c (fold_ternary_loc) <case BIT_FIELD_REF>: Use
+ VECTOR_TYPE_P macro. If type is vector type, VIEW_CONVERT_EXPR the
+ VECTOR_CST element to type.
+
2018-04-19 H.J. Lu <hongjiu.lu@intel.com>
PR target/85397
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 3a99b66..6472f10 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -11631,7 +11631,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
case BIT_FIELD_REF:
if (TREE_CODE (arg0) == VECTOR_CST
&& (type == TREE_TYPE (TREE_TYPE (arg0))
- || (TREE_CODE (type) == VECTOR_TYPE
+ || (VECTOR_TYPE_P (type)
&& TREE_TYPE (type) == TREE_TYPE (TREE_TYPE (arg0))))
&& tree_fits_uhwi_p (op1)
&& tree_fits_uhwi_p (op2))
@@ -11653,7 +11653,12 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
if (TREE_CODE (arg0) == VECTOR_CST)
{
if (n == 1)
- return VECTOR_CST_ELT (arg0, idx);
+ {
+ tem = VECTOR_CST_ELT (arg0, idx);
+ if (VECTOR_TYPE_P (type))
+ tem = fold_build1 (VIEW_CONVERT_EXPR, type, tem);
+ return tem;
+ }
tree_vector_builder vals (type, n, 1);
for (unsigned i = 0; i < n; ++i)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index bff3cd6..a6b2542 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2018-04-19 Jakub Jelinek <jakub@redhat.com>
+
+ PR tree-optimization/85467
+ * gcc.dg/pr85467.c: New test.
+
2018-04-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/84611
diff --git a/gcc/testsuite/gcc.dg/pr85467.c b/gcc/testsuite/gcc.dg/pr85467.c
new file mode 100644
index 0000000..4895e37
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr85467.c
@@ -0,0 +1,30 @@
+/* PR tree-optimization/85467 */
+/* { dg-do compile } */
+/* { dg-options "-O2 -fno-tree-ccp --param=sccvn-max-scc-size=10" } */
+
+#define TEST(N, T) \
+typedef T V##N __attribute__ ((__vector_size__ (sizeof (T)))); \
+ \
+V##N \
+bar##N (V##N u, V##N v) \
+{ \
+ do \
+ v *= (T)((V##N){}[0] ? u[v[0]] : 0); \
+ while ((V##N){}[0]); \
+ return v; \
+} \
+ \
+void \
+foo##N (void) \
+{ \
+ bar##N ((V##N){}, (V##N){}); \
+}
+
+TEST (1, char)
+TEST (2, short)
+TEST (3, int)
+TEST (4, long)
+TEST (5, long long)
+#ifdef __SIZEOF_INT128__
+TEST (6, __int128)
+#endif