Hi!

The simd clones IPA pass is gated on
targetm.simd_clone.compute_vecsize_and_simdlen != NULL
so when we are calling expand_simd_clones later, we shouldn't call it
if it is NULL.

Bootstrapped/regtested on x86_64-linux and i686-linux, tested with
powerpc64le-linux cross on the testcase, committed to trunk.

2018-02-19  Jakub Jelinek  <ja...@redhat.com>

        PR tree-optimization/84452
        * tree-vect-patterns.c (vect_recog_pow_pattern): Don't call
        expand_simd_clones if targetm.simd_clone.compute_vecsize_and_simdlen
        is NULL.

        * gcc.dg/pr84452.c: New test.

--- gcc/tree-vect-patterns.c.jj 2018-02-13 09:33:31.118560170 +0100
+++ gcc/tree-vect-patterns.c    2018-02-19 11:15:04.181270004 +0100
@@ -1113,7 +1113,8 @@ vect_recog_pow_pattern (vec<gimple *> *s
              cgraph_node *node = cgraph_node::get_create (exp_decl);
              if (node->simd_clones == NULL)
                {
-                 if (node->definition)
+                 if (targetm.simd_clone.compute_vecsize_and_simdlen == NULL
+                     || node->definition)
                    return NULL;
                  expand_simd_clones (node);
                  if (node->simd_clones == NULL)
--- gcc/testsuite/gcc.dg/pr84452.c.jj   2018-02-19 11:17:37.045283314 +0100
+++ gcc/testsuite/gcc.dg/pr84452.c      2018-02-19 11:18:45.769289300 +0100
@@ -0,0 +1,14 @@
+/* PR tree-optimization/84452 */
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+
+double pow (double, double) __attribute__((simd));
+double exp (double) __attribute__((simd));
+extern double a[1024], b[1024];
+
+void
+foo (void)
+{
+  for (int i = 0; i < 1024; ++i)
+    a[i] = pow (2.0, b[i]);
+}

        Jakub

Reply via email to