re PR tree-optimization/62021 (ICE in verify_gimple_assign_single)
authorJakub Jelinek <jakub@redhat.com>
Wed, 10 Dec 2014 20:01:12 +0000 (21:01 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 10 Dec 2014 20:01:12 +0000 (21:01 +0100)
PR tree-optimization/62021
* omp-low.c (simd_clone_adjust_return_type): Use
vector of pointer_sized_int_node types instead vector of pointer
types.
(simd_clone_adjust_argument_types): Likewise.

* gcc.dg/vect/pr62021.c: New test.

From-SVN: r218603

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr62021.c [new file with mode: 0644]

index cce54061e4da34eae5692e9301b5a7510769df45..29f3e6bd25bfa8d87c68c0ecfdb0de2a8e3c2970 100644 (file)
@@ -1,3 +1,11 @@
+2014-12-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/62021
+       * omp-low.c (simd_clone_adjust_return_type): Use
+       vector of pointer_sized_int_node types instead vector of pointer
+       types.
+       (simd_clone_adjust_argument_types): Likewise.
+
 2014-12-10  Jakub Jelinek  <jakub@redhat.com>
            Evgeny Stupachenko  <evstupac@gmail.com>
 
index a5cf9251973317ffa29efabd92a13c5ac7cebee1..ef143ab5651c90ff0903336c94a545ea6f36a44c 100644 (file)
@@ -11590,24 +11590,24 @@ simd_clone_adjust_return_type (struct cgraph_node *node)
   if (orig_rettype == void_type_node)
     return NULL_TREE;
   TREE_TYPE (fndecl) = build_distinct_type_copy (TREE_TYPE (fndecl));
-  if (INTEGRAL_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))
-      || POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))))
+  t = TREE_TYPE (TREE_TYPE (fndecl));
+  if (INTEGRAL_TYPE_P (t) || POINTER_TYPE_P (t))
     veclen = node->simdclone->vecsize_int;
   else
     veclen = node->simdclone->vecsize_float;
-  veclen /= GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (TREE_TYPE (fndecl))));
+  veclen /= GET_MODE_BITSIZE (TYPE_MODE (t));
   if (veclen > node->simdclone->simdlen)
     veclen = node->simdclone->simdlen;
+  if (POINTER_TYPE_P (t))
+    t = pointer_sized_int_node;
   if (veclen == node->simdclone->simdlen)
-    TREE_TYPE (TREE_TYPE (fndecl))
-      = build_vector_type (TREE_TYPE (TREE_TYPE (fndecl)),
-                          node->simdclone->simdlen);
+    t = build_vector_type (t, node->simdclone->simdlen);
   else
     {
-      t = build_vector_type (TREE_TYPE (TREE_TYPE (fndecl)), veclen);
+      t = build_vector_type (t, veclen);
       t = build_array_type_nelts (t, node->simdclone->simdlen / veclen);
-      TREE_TYPE (TREE_TYPE (fndecl)) = t;
     }
+  TREE_TYPE (TREE_TYPE (fndecl)) = t;
   if (!node->definition)
     return NULL_TREE;
 
@@ -11696,7 +11696,10 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
          if (veclen > node->simdclone->simdlen)
            veclen = node->simdclone->simdlen;
          adj.arg_prefix = "simd";
-         adj.type = build_vector_type (parm_type, veclen);
+         if (POINTER_TYPE_P (parm_type))
+           adj.type = build_vector_type (pointer_sized_int_node, veclen);
+         else
+           adj.type = build_vector_type (parm_type, veclen);
          node->simdclone->args[i].vector_type = adj.type;
          for (j = veclen; j < node->simdclone->simdlen; j += veclen)
            {
@@ -11737,7 +11740,10 @@ simd_clone_adjust_argument_types (struct cgraph_node *node)
       veclen /= GET_MODE_BITSIZE (TYPE_MODE (base_type));
       if (veclen > node->simdclone->simdlen)
        veclen = node->simdclone->simdlen;
-      adj.type = build_vector_type (base_type, veclen);
+      if (POINTER_TYPE_P (base_type))
+       adj.type = build_vector_type (pointer_sized_int_node, veclen);
+      else
+       adj.type = build_vector_type (base_type, veclen);
       adjustments.safe_push (adj);
 
       for (j = veclen; j < node->simdclone->simdlen; j += veclen)
index 0f204acd684b2b591680a3bd9d823d632ed322c2..0352b28df04252db0514e7d1a2b2e294181d8215 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-10  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/62021
+       * gcc.dg/vect/pr62021.c: New test.
+
 2014-12-10  Jakub Jelinek  <jakub@redhat.com>
            Evgeny Stupachenko  <evstupac@gmail.com>
 
diff --git a/gcc/testsuite/gcc.dg/vect/pr62021.c b/gcc/testsuite/gcc.dg/vect/pr62021.c
new file mode 100644 (file)
index 0000000..e0208e6
--- /dev/null
@@ -0,0 +1,30 @@
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-fopenmp-simd" } */
+/* { dg-additional-options "-mavx" { target avx_runtime } } */
+
+#pragma omp declare simd linear(y)
+__attribute__((noinline)) int *
+foo (int *x, int y)
+{
+  return x + y;
+}
+
+int a[1024];
+int *b[1024] = { &a[0] };
+
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 1024; i++)
+    b[i] = &a[1023 - i];
+  #pragma omp simd
+  for (i = 0; i < 1024; i++)
+    b[i] = foo (b[i], i);
+  for (i = 0; i < 1024; i++)
+    if (b[i] != &a[1023])
+      __builtin_abort ();
+  return 0;
+}
+
+/* { dg-final { cleanup-tree-dump "vect" } } */