From c392943c5049a94782fe548003ddd0913b09b292 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 11 Jul 2016 22:37:18 +0200 Subject: [PATCH] re PR tree-optimization/71823 (g++ segfaults with -mfma and -ftree-slp-vectorize) 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/vect/pr71823.c | 14 ++++++++++++++ gcc/tree-vect-stmts.c | 7 ++----- 4 files changed, 27 insertions(+), 5 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/vect/pr71823.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0f8fb539235..ac3f065e1b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-07-11 Jakub Jelinek + + 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 * config/i386/predicates.md (x86_64_immediate_operand) : diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4ddd499777..067370114c9 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-07-11 Jakub Jelinek + + PR tree-optimization/71823 + * gcc.dg/vect/pr71823.c: New test. + 2016-07-11 David Malcolm * 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 index 00000000000..079cde41ce4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/vect/pr71823.c @@ -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; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index ffa5e9881d6..8c77d7e43ea 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -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 { -- 2.30.2