On Fri, 20 Apr 2012, Jakub Jelinek wrote: > Hi! > > This patch fixes ICE in adjust_bool_pattern, trueval in that case has > the vector type's element type, which is full precision of mode, > so when we see a smaller precision, we need to use build_nonstandard_type. > Bootstrapped/regtested on x86_64-linux and i686-linux, ok > for trunk and 4.7 (where this is latent, as the pattern recognizer > doesn't do SLP there, but something similar could appear in loops)?
Ok. Thanks, Richard. > 2012-04-20 Jakub Jelinek <ja...@redhat.com> > > PR tree-optimizations/52891 > * tree-vect-patterns.c (adjust_bool_pattern): Use > build_nonstandard_type even if rhs1 has unsigned INTEGER_TYPE, > but with non-standard precision. > > * gcc.c-torture/compile/pr52891-1.c: New test. > * gcc.c-torture/compile/pr52891-2.c: New test. > > --- gcc/tree-vect-patterns.c.jj 2012-04-19 11:09:13.000000000 +0200 > +++ gcc/tree-vect-patterns.c 2012-04-20 14:39:52.597285475 +0200 > @@ -2300,7 +2300,9 @@ adjust_bool_pattern (tree var, tree out_ > default: > gcc_assert (TREE_CODE_CLASS (rhs_code) == tcc_comparison); > if (TREE_CODE (TREE_TYPE (rhs1)) != INTEGER_TYPE > - || !TYPE_UNSIGNED (TREE_TYPE (rhs1))) > + || !TYPE_UNSIGNED (TREE_TYPE (rhs1)) > + || (TYPE_PRECISION (TREE_TYPE (rhs1)) > + != GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (rhs1))))) > { > enum machine_mode mode = TYPE_MODE (TREE_TYPE (rhs1)); > itype > --- gcc/testsuite/gcc.c-torture/compile/pr52891-1.c.jj 2012-04-20 > 14:46:48.154737808 +0200 > +++ gcc/testsuite/gcc.c-torture/compile/pr52891-1.c 2012-04-20 > 14:46:23.000000000 +0200 > @@ -0,0 +1,20 @@ > +/* PR tree-optimizations/52891 */ > + > +struct S > +{ > + int a; > + struct T { unsigned c : 10; } b; > +} s; > + > +void > +bar (short x, short y, int **p) > +{ > + if ((x && y) + **p) > + while (1); > +} > + > +void > +foo (int **p) > +{ > + bar (s.a, s.b.c, p); > +} > --- gcc/testsuite/gcc.c-torture/compile/pr52891-2.c.jj 2012-04-20 > 14:46:51.199716933 +0200 > +++ gcc/testsuite/gcc.c-torture/compile/pr52891-2.c 2012-04-20 > 14:46:01.000000000 +0200 > @@ -0,0 +1,12 @@ > +/* PR tree-optimizations/52891 */ > + > +struct __attribute__((packed)) S { unsigned s : 22; }; > +struct __attribute__((packed)) T { struct S t; } c; > +int a, b, d; > + > +void > +foo (void) > +{ > + if (1 ? (!c.t.s & (d < 0)) < a : 0) > + b = 0; > +} > > Jakub > > -- Richard Guenther <rguent...@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer