re PR tree-optimization/71823 (g++ segfaults with -mfma and -ftree-slp-vectorize)
authorJakub Jelinek <jakub@redhat.com>
Mon, 11 Jul 2016 20:37:18 +0000 (22:37 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 11 Jul 2016 20:37:18 +0000 (22:37 +0200)
PR tree-optimization/71823
* tree-vect-stmts.c (vectorizable_operation): Use vect_get_vec_defs
to get vec_oprnds2 from op2.

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

From-SVN: r238229

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/pr71823.c [new file with mode: 0644]
gcc/tree-vect-stmts.c

index 0f8fb53923529f34fc0c4c7f2b88fe3883c94839..ac3f065e1b13c02f0167333c4f535c7afe7079ea 100644 (file)
@@ -1,3 +1,9 @@
+2016-07-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/71823
+       * tree-vect-stmts.c (vectorizable_operation): Use vect_get_vec_defs
+       to get vec_oprnds2 from op2.
+
 2016-07-11  Uros Bizjak  <ubizjak@gmail.com>
 
        * config/i386/predicates.md (x86_64_immediate_operand) <case CONST>:
index b4ddd499777396f38b451b9f22ef4003f0e72c65..067370114c91a57f4fb5525d5e9e3b8c44147d53 100644 (file)
@@ -1,3 +1,8 @@
+2016-07-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimization/71823
+       * gcc.dg/vect/pr71823.c: New test.
+
 2016-07-11  David Malcolm  <dmalcolm@redhat.com>
 
        * gcc.dg/plugin/location_overflow_plugin.c (plugin_init): Avoid
diff --git a/gcc/testsuite/gcc.dg/vect/pr71823.c b/gcc/testsuite/gcc.dg/vect/pr71823.c
new file mode 100644 (file)
index 0000000..079cde4
--- /dev/null
@@ -0,0 +1,14 @@
+/* PR tree-optimization/71823 */
+/* { dg-do compile } */
+/* { dg-additional-options "-mfma" { target i?86-*-* x86_64-*-* } } */
+
+float a[4], b[4];
+
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 4; ++i)
+    b[i] = __builtin_fma (1024.0f, 1024.0f, a[i]);
+  return 0;
+}
index ffa5e9881d683e3a647c4e7b40aa9cd37f659459..8c77d7e43ea09f7dd7d56dd697b741238566e808 100644 (file)
@@ -5362,11 +5362,8 @@ vectorizable_operation (gimple *stmt, gimple_stmt_iterator *gsi,
            vect_get_vec_defs (op0, NULL_TREE, stmt, &vec_oprnds0, NULL,
                               slp_node, -1);
          if (op_type == ternary_op)
-           {
-             vec_oprnds2.create (1);
-             vec_oprnds2.quick_push (vect_get_vec_def_for_operand (op2,
-                                                                   stmt));
-           }
+           vect_get_vec_defs (op2, NULL_TREE, stmt, &vec_oprnds2, NULL,
+                              slp_node, -1);
        }
       else
        {