Re: PR82665 - missing value range optimization for memchr

2018-05-01 Thread Jeff Law
On 01/06/2018 11:58 PM, Prathamesh Kulkarni wrote: > On 5 January 2018 at 00:20, Jeff Law wrote: >> On 01/03/2018 12:08 AM, Prathamesh Kulkarni wrote: >>> On 3 January 2018 at 12:33, Prathamesh Kulkarni >>> wrote: On 2 January 2018 at 17:49, Jakub Jelinek wrote: > On Tue, Jan 02, 2018 a

Re: PR82665 - missing value range optimization for memchr

2018-01-11 Thread Richard Biener
On Wed, Jan 10, 2018 at 9:59 PM, Jeff Law wrote: > On 01/06/2018 11:58 PM, Prathamesh Kulkarni wrote: > [ Snip ] > >>> I think with those changes we're probably in good shape. But please >>> repost for final approval. >> I have the updated the attached version with your suggestions. >> Does it lo

Re: PR82665 - missing value range optimization for memchr

2018-01-10 Thread Jeff Law
On 01/06/2018 11:58 PM, Prathamesh Kulkarni wrote: [ Snip ] >> I think with those changes we're probably in good shape. But please >> repost for final approval. > I have the updated the attached version with your suggestions. > Does it look OK ? > Bootstrap+test passes on x86_64-unknown-linux-gnu

Re: PR82665 - missing value range optimization for memchr

2018-01-09 Thread Prathamesh Kulkarni
On 7 January 2018 at 12:28, Prathamesh Kulkarni wrote: > On 5 January 2018 at 00:20, Jeff Law wrote: >> On 01/03/2018 12:08 AM, Prathamesh Kulkarni wrote: >>> On 3 January 2018 at 12:33, Prathamesh Kulkarni >>> wrote: On 2 January 2018 at 17:49, Jakub Jelinek wrote: > On Tue, Jan 02, 2

Re: PR82665 - missing value range optimization for memchr

2018-01-06 Thread Prathamesh Kulkarni
On 5 January 2018 at 00:20, Jeff Law wrote: > On 01/03/2018 12:08 AM, Prathamesh Kulkarni wrote: >> On 3 January 2018 at 12:33, Prathamesh Kulkarni >> wrote: >>> On 2 January 2018 at 17:49, Jakub Jelinek wrote: On Tue, Jan 02, 2018 at 05:39:17PM +0530, Prathamesh Kulkarni wrote: > --- /

Re: PR82665 - missing value range optimization for memchr

2018-01-04 Thread Jeff Law
On 01/03/2018 12:08 AM, Prathamesh Kulkarni wrote: > On 3 January 2018 at 12:33, Prathamesh Kulkarni > wrote: >> On 2 January 2018 at 17:49, Jakub Jelinek wrote: >>> On Tue, Jan 02, 2018 at 05:39:17PM +0530, Prathamesh Kulkarni wrote: --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr

Re: PR82665 - missing value range optimization for memchr

2018-01-02 Thread Prathamesh Kulkarni
On 3 January 2018 at 12:33, Prathamesh Kulkarni wrote: > On 2 January 2018 at 17:49, Jakub Jelinek wrote: >> On Tue, Jan 02, 2018 at 05:39:17PM +0530, Prathamesh Kulkarni wrote: >>> --- /dev/null >>> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82665.c >>> @@ -0,0 +1,22 @@ >>> +/* { dg-do compile } */ >

Re: PR82665 - missing value range optimization for memchr

2018-01-02 Thread Prathamesh Kulkarni
On 2 January 2018 at 17:49, Jakub Jelinek wrote: > On Tue, Jan 02, 2018 at 05:39:17PM +0530, Prathamesh Kulkarni wrote: >> --- /dev/null >> +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82665.c >> @@ -0,0 +1,22 @@ >> +/* { dg-do compile } */ >> +/* { dg-options "-O2 -fdump-tree-optimized" } */ >> + >> +vo

Re: PR82665 - missing value range optimization for memchr

2018-01-02 Thread Jakub Jelinek
On Tue, Jan 02, 2018 at 05:39:17PM +0530, Prathamesh Kulkarni wrote: > --- /dev/null > +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr82665.c > @@ -0,0 +1,22 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -fdump-tree-optimized" } */ > + > +void f1 (char *p, __SIZE_TYPE__ sz) > +{ > + char *q = __bui

Re: PR82665 - missing value range optimization for memchr

2018-01-02 Thread Prathamesh Kulkarni
On 20 November 2017 at 16:19, Jakub Jelinek wrote: > On Mon, Nov 20, 2017 at 04:13:49PM +0530, Prathamesh Kulkarni wrote: >> Hi, >> The attached patch tries to fix PR82665 by adding value-range for 'n' >> to [0, PTRDIFF_MAX - 1] in the following case: >> def = memchr(arg, 0, sz); >> n = def - arg

Re: PR82665 - missing value range optimization for memchr

2017-11-20 Thread Jakub Jelinek
On Mon, Nov 20, 2017 at 04:13:49PM +0530, Prathamesh Kulkarni wrote: > Hi, > The attached patch tries to fix PR82665 by adding value-range for 'n' > to [0, PTRDIFF_MAX - 1] in the following case: > def = memchr(arg, 0, sz); > n = def - arg > > where def and arg are char *. I suppose it's safe to a

PR82665 - missing value range optimization for memchr

2017-11-20 Thread Prathamesh Kulkarni
Hi, The attached patch tries to fix PR82665 by adding value-range for 'n' to [0, PTRDIFF_MAX - 1] in the following case: def = memchr(arg, 0, sz); n = def - arg where def and arg are char *. I suppose it's safe to assume that if arg is char *, then memchr(arg, 0, sz) would return a non NULL pointe