On Thu, 3 Jan 2013, Jakub Jelinek wrote: > Hi! > > While omit_one_operand_loc fold_converts the value to the right type, > when type is vector, it is not possible to convert that way > integer_one_node. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk?
Ok. Thanks, Richard. > 2013-01-03 Jakub Jelinek <ja...@redhat.com> > Marc Glisse <marc.gli...@inria.fr> > > PR tree-optimization/55832 > * fold-const.c (fold_binary_loc): For ABS_EXPR<x> >= 0 and > ABS_EXPR<x> < 0 folding use constant_boolean_node instead of > integer_{one,zero}_node. > > * gcc.c-torture/compile/pr55832.c: New test. > > --- gcc/fold-const.c.jj 2012-12-06 15:35:35.000000000 +0100 > +++ gcc/fold-const.c 2013-01-02 09:48:42.906797768 +0100 > @@ -13519,7 +13519,9 @@ fold_binary_loc (location_t loc, > "when simplifying comparison of " > "absolute value and zero"), > WARN_STRICT_OVERFLOW_CONDITIONAL); > - return omit_one_operand_loc (loc, type, integer_one_node, arg0); > + return omit_one_operand_loc (loc, type, > + constant_boolean_node (true, type), > + arg0); > } > > /* Convert ABS_EXPR<x> < 0 to false. */ > @@ -13533,7 +13535,9 @@ fold_binary_loc (location_t loc, > "when simplifying comparison of " > "absolute value and zero"), > WARN_STRICT_OVERFLOW_CONDITIONAL); > - return omit_one_operand_loc (loc, type, integer_zero_node, arg0); > + return omit_one_operand_loc (loc, type, > + constant_boolean_node (false, type), > + arg0); > } > > /* If X is unsigned, convert X < (1 << Y) into X >> Y == 0 > --- gcc/testsuite/gcc.c-torture/compile/pr55832.c.jj 2013-01-02 > 10:00:53.271626853 +0100 > +++ gcc/testsuite/gcc.c-torture/compile/pr55832.c 2013-01-02 > 10:00:44.000000000 +0100 > @@ -0,0 +1,23 @@ > +/* PR tree-optimization/55832 */ > + > +int g, b; > + > +void > +foo (void) > +{ > + union U { int i; unsigned short s; } a = { 0 }; > + unsigned char c; > + unsigned short d = 0, *p = &a.s; > + > + if (g) > + a.i--; > + > + if (b && a.i < (d = 1)) > + return; > + > + for (; a.i < 15; a.i++) > + b |= d <= c; > + > + if (!*p) > + g = 0; > +} > > Jakub > > -- Richard Biener <rguent...@suse.de> SUSE / SUSE Labs SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746 GF: Jeff Hawn, Jennifer Guild, Felix Imend