On Fri, 17 Jan 2020, Jakub Jelinek wrote:

> Hi!
> 
> The following testcase ICEs on powerpc64le-linux.  The problem is that
> get_vectype_for_scalar_type returns NULL, and while most places in
> tree-vect-stmts.c handle that case, this spot doesn't and punts only
> if it is non-NULL, but with different number of elts than expected.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK.

Richard.

> 2020-01-16  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR tree-optimization/93292
>       * tree-vect-stmts.c (vectorizable_comparison): Punt also if
>       get_vectype_for_scalar_type returns NULL.
> 
>       * g++.dg/opt/pr93292.C: New test.
> 
> --- gcc/tree-vect-stmts.c.jj  2020-01-12 11:54:38.522381590 +0100
> +++ gcc/tree-vect-stmts.c     2020-01-16 19:42:30.608888882 +0100
> @@ -10492,7 +10492,7 @@ vectorizable_comparison (stmt_vec_info s
>      {
>        vectype = get_vectype_for_scalar_type (vinfo, TREE_TYPE (rhs1),
>                                            slp_node);
> -      if (maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits))
> +      if (!vectype || maybe_ne (TYPE_VECTOR_SUBPARTS (vectype), nunits))
>       return false;
>      }
>    else if (maybe_ne (nunits, TYPE_VECTOR_SUBPARTS (vectype)))
> --- gcc/testsuite/g++.dg/opt/pr93292.C.jj     2020-01-16 19:48:51.110144613 
> +0100
> +++ gcc/testsuite/g++.dg/opt/pr93292.C        2020-01-16 19:47:57.351956177 
> +0100
> @@ -0,0 +1,18 @@
> +// PR tree-optimization/93292
> +// { dg-do compile }
> +// { dg-options "-O3 -w" }
> +
> +struct A {
> +  static int foo (float x) { static int b; b = x ? x + 0.5 : 0; return b; }
> +};
> +
> +void
> +bar (int *d, float e)
> +{
> +  float g;
> +  for (int h = 0; h < 64; h++)
> +    {
> +      d[h] += A::foo (g < 0 ? : g > 5 ? : g);
> +      A::foo (e);
> +    }
> +}
> 
>       Jakub
> 
> 

-- 
Richard Biener <rguent...@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)

Reply via email to