This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix SLP vectorization ICE (PR tree-optimization/71823)
- From: Richard Biener <rguenther at suse dot de>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 11 Jul 2016 22:07:24 +0200
- Subject: Re: [PATCH] Fix SLP vectorization ICE (PR tree-optimization/71823)
- Authentication-results: sourceware.org; auth=none
- References: <20160711192843.GO7387@tucnak.redhat.com>
On July 11, 2016 9:28:43 PM GMT+02:00, Jakub Jelinek <jakub@redhat.com> wrote:
>Hi!
>
>vect_get_vec_defs handles only one or two arguments, for ternary
>ops like fma vectorizable_operation calls vect_get_vec_defs on the
>first two arguments, and then did
> vec_oprnds2.create (1);
> vec_oprnds2.quick_push (vect_get_vec_def_for_operand (op2,
> stmt));
>which is what vect_get_vec_defs does, but only for loop vectorization.
>The following patch uses vect_get_vec_defs again so that it does what
>it
>did before for loop vectorization, but additionally handles properly
>slp vectorization.
>
>Bootstrapped/regtested on x86_64-linux and i686-linux, ok for
>trunk/6.2?
OK.
Thanks,
Richard.
>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.
>
> * gcc.dg/vect/pr71823.c: New test.
>
>--- gcc/tree-vect-stmts.c.jj 2016-07-07 20:40:43.000000000 +0200
>+++ gcc/tree-vect-stmts.c 2016-07-11 12:05:52.501823209 +0200
>@@ -5362,11 +5362,8 @@ vectorizable_operation (gimple *stmt, gi
> 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
> {
>--- gcc/testsuite/gcc.dg/vect/pr71823.c.jj 2016-07-11
>12:07:41.687485519 +0200
>+++ gcc/testsuite/gcc.dg/vect/pr71823.c 2016-07-11 12:08:42.449741939
>+0200
>@@ -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;
>+}
>
> Jakub