On Tue, 18 Feb 2020, Jakub Jelinek wrote: > Hi! > > The following testcase ICEs, because execute_update_addresses_taken attempts > to create a VECTOR_TYPE with non-power of 2 number of elts. > Fixed by guarding it with the corresponding predicate. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
OK. Richard. > 2020-02-17 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimization/93780 > * tree-ssa.c (non_rewritable_lvalue_p): Check valid_vector_subparts_p > before calling build_vector_type. > (execute_update_addresses_taken): Likewise. > > * gcc.dg/pr93780.c: New test. > > --- gcc/tree-ssa.c.jj 2020-01-12 11:54:38.515381696 +0100 > +++ gcc/tree-ssa.c 2020-02-17 10:54:32.481615050 +0100 > @@ -1550,7 +1550,8 @@ non_rewritable_lvalue_p (tree lhs) > && multiple_p (lhs_bits, > tree_to_uhwi > (TYPE_SIZE (TREE_TYPE (TREE_TYPE (decl)))), > - &nelts)) > + &nelts) > + && valid_vector_subparts_p (nelts)) > { > if (known_eq (nelts, 1u)) > return false; > @@ -1925,7 +1926,8 @@ execute_update_addresses_taken (void) > (TYPE_SIZE (TREE_TYPE > (TREE_TYPE (sym)))), > &nelts) > - && maybe_ne (nelts, 1u)) > + && maybe_ne (nelts, 1u) > + && valid_vector_subparts_p (nelts)) > temtype = build_vector_type (temtype, nelts); > tree tem = make_ssa_name (temtype); > gimple *pun > --- gcc/testsuite/gcc.dg/pr93780.c.jj 2020-02-17 10:44:31.839583128 +0100 > +++ gcc/testsuite/gcc.dg/pr93780.c 2020-02-17 10:44:16.453812697 +0100 > @@ -0,0 +1,15 @@ > +/* PR tree-optimization/93780 */ > +/* { dg-do compile } */ > +/* { dg-options "-O2" } */ > +/* { dg-additional-options "-mavx" { target avx } } */ > + > +typedef float V __attribute__((vector_size (32))); > + > +float > +foo (void) > +{ > + const float init[6] = {}; > + V v = {}; > + __builtin_memcpy (&v, init, sizeof (init)); > + return v[0]; > +} > > Jakub > > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imendörffer; HRB 36809 (AG Nuernberg)