Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

2019-07-17  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/91181
        * tree-vect-slp.c (vect_build_slp_tree_1): Do not compare
        IFN_LOADs as calls.

        * gcc.dg/pr91181.c: New testcase.

Index: gcc/tree-vect-slp.c
===================================================================
--- gcc/tree-vect-slp.c (revision 273490)
+++ gcc/tree-vect-slp.c (working copy)
@@ -857,7 +857,7 @@ vect_build_slp_tree_1 (unsigned char *sw
              continue;
            }
 
-         if (rhs_code == CALL_EXPR)
+         if (!load_p && rhs_code == CALL_EXPR)
            {
              if (!compatible_calls_p (as_a <gcall *> (stmts[0]->stmt),
                                       as_a <gcall *> (stmt)))
Index: gcc/testsuite/gcc.dg/pr91181.c
===================================================================
--- gcc/testsuite/gcc.dg/pr91181.c      (nonexistent)
+++ gcc/testsuite/gcc.dg/pr91181.c      (working copy)
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-Ofast" } */
+/* { dg-additional-options "-mavx" { target x86_64-*-* i?86-*-* } } */
+
+enum { a, b, c };
+float *d, *e;
+int f, g, h, i;
+int j()
+{
+  float a;
+  for (; h; h++)
+    {
+      i = h * 4;
+      a = d[i + b];
+      if (a) {
+         e[i + b] = g < d[i + b] * f * a ? g : d[i + b] * f * a;
+         e[i + c] = g < d[i + c] * f * a ? g : d[i + c] * f * a;
+      }
+      e[i + b] = e[i + c];
+    }
+}

Reply via email to