diff mbox

Fix PR69595, bogus -Warray-bound warning

Message ID alpine.LSU.2.11.1602150946330.1392@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Feb. 15, 2016, 8:49 a.m. UTC
On Sun, 14 Feb 2016, Marc Glisse wrote:

> On Tue, 2 Feb 2016, Richard Biener wrote:
> 
> > *** gcc/match.pd	(revision 233067)
> > --- gcc/match.pd	(working copy)
> > *************** DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> > *** 2094,2099 ****
> > --- 2094,2117 ----
> >   (bit_and:c (ordered @0 @0) (ordered:c@2 @0 @1))
> >   @2)
> > 
> > + /* Simple range test simplifications.  */
> > + /* A < B || A >= B -> true.  */
> > + (for test1 (lt le ne)
> > +      test2 (ge gt eq)
> > +  (simplify
> > +   (bit_ior:c (test1 @0 @1) (test2 @0 @1))
> > +   (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
> > +        || VECTOR_INTEGER_TYPE_P (TREE_TYPE (@0)))
> > +    { constant_boolean_node (true, type); })))
> > + /* A < B && A >= B -> false.  */
> > + (for test1 (lt lt lt le ne eq)
> > +      test2 (ge gt eq gt eq gt)
> 
> The lack of symmetry between the || and && cases is surprising. Is there any
> reason not to handle the pairs le/ge, le/ne and ge/ne for bit_ior?

Whoops, no.  I simply forgot those.  I'll bootstrap/test

2016-02-15  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/69595
	* match.pd: Complete range test simplification to true.

Comments

Richard Biener Feb. 15, 2016, 1:48 p.m. UTC | #1
On Mon, 15 Feb 2016, Richard Biener wrote:

> On Sun, 14 Feb 2016, Marc Glisse wrote:
> 
> > On Tue, 2 Feb 2016, Richard Biener wrote:
> > 
> > > *** gcc/match.pd	(revision 233067)
> > > --- gcc/match.pd	(working copy)
> > > *************** DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
> > > *** 2094,2099 ****
> > > --- 2094,2117 ----
> > >   (bit_and:c (ordered @0 @0) (ordered:c@2 @0 @1))
> > >   @2)
> > > 
> > > + /* Simple range test simplifications.  */
> > > + /* A < B || A >= B -> true.  */
> > > + (for test1 (lt le ne)
> > > +      test2 (ge gt eq)
> > > +  (simplify
> > > +   (bit_ior:c (test1 @0 @1) (test2 @0 @1))
> > > +   (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
> > > +        || VECTOR_INTEGER_TYPE_P (TREE_TYPE (@0)))
> > > +    { constant_boolean_node (true, type); })))
> > > + /* A < B && A >= B -> false.  */
> > > + (for test1 (lt lt lt le ne eq)
> > > +      test2 (ge gt eq gt eq gt)
> > 
> > The lack of symmetry between the || and && cases is surprising. Is there any
> > reason not to handle the pairs le/ge, le/ne and ge/ne for bit_ior?
> 
> Whoops, no.  I simply forgot those.  I'll bootstrap/test

Bootstrapped / tested on x86_64-unknown-linux-gnu, applied.

Richard.

> 2016-02-15  Richard Biener  <rguenther@suse.de>
> 
> 	PR tree-optimization/69595
> 	* match.pd: Complete range test simplification to true.
> 
> Index: gcc/match.pd
> ===================================================================
> --- gcc/match.pd	(revision 233369)
> +++ gcc/match.pd	(working copy)
> @@ -2119,8 +2119,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
>  
>  /* Simple range test simplifications.  */
>  /* A < B || A >= B -> true.  */
> -(for test1 (lt le ne)
> -     test2 (ge gt eq)
> +(for test1 (lt le le le ne ge)
> +     test2 (ge gt ge ne eq ne)
>   (simplify
>    (bit_ior:c (test1 @0 @1) (test2 @0 @1))
>    (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))
>
diff mbox

Patch

Index: gcc/match.pd
===================================================================
--- gcc/match.pd	(revision 233369)
+++ gcc/match.pd	(working copy)
@@ -2119,8 +2119,8 @@  DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
 
 /* Simple range test simplifications.  */
 /* A < B || A >= B -> true.  */
-(for test1 (lt le ne)
-     test2 (ge gt eq)
+(for test1 (lt le le le ne ge)
+     test2 (ge gt ge ne eq ne)
  (simplify
   (bit_ior:c (test1 @0 @1) (test2 @0 @1))
   (if (INTEGRAL_TYPE_P (TREE_TYPE (@0))