Re: fold x ^ y to 0 if x == y

2016-10-06 Thread Jeff Law
On 10/06/2016 01:18 AM, Richard Biener wrote: It ought to be easy to fold x ^ y to zero when x == y (famous last words). I'm sure I'll regret saying that when I go to look at how to twiddle DOM appropriately. Interesting idea. Though it get's (theoretically) interesting for ternary ops where

Re: fold x ^ y to 0 if x == y

2016-10-06 Thread Richard Biener
On Wed, 5 Oct 2016, Jeff Law wrote: > On 07/08/2016 05:17 AM, Richard Biener wrote: > > On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: > > > > > Hi Richard, > > > For the following test-case: > > > > > > int f(int x, int y) > > > { > > >int ret; > > > > > >if (x == y) > > > ret = x

Re: fold x ^ y to 0 if x == y

2016-10-05 Thread Jeff Law
On 07/20/2016 04:09 PM, Prathamesh Kulkarni wrote: Oops wrong test-case, the dump below is of the following test-case: int f(int x, int y) { int ret = 10; if (x == y) ret = x - y; return ret; } DOM ought to be catching this as well and does with the hack patch I've done for the firs

Re: fold x ^ y to 0 if x == y

2016-10-05 Thread Jeff Law
On 07/20/2016 04:07 PM, Prathamesh Kulkarni wrote: Not record both equivalences. This might break the testcase it was introduced for (obviously). Which is why I CCed Jeff for his opinion. Well, folding happens for x - y, if x == y. int f(int x, int y) { int ret; if (x == y) ret = x -

Re: fold x ^ y to 0 if x == y

2016-10-05 Thread Jeff Law
On 07/08/2016 05:17 AM, Richard Biener wrote: On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: Hi Richard, For the following test-case: int f(int x, int y) { int ret; if (x == y) ret = x ^ y; else ret = 1; return ret; } I was wondering if x ^ y should be folded to 0 sinc

Re: fold x ^ y to 0 if x == y

2016-07-21 Thread Richard Biener
On Wed, 20 Jul 2016, Prathamesh Kulkarni wrote: > On 20 July 2016 at 16:35, Richard Biener wrote: > > On Wed, 20 Jul 2016, Prathamesh Kulkarni wrote: > > > >> On 8 July 2016 at 12:29, Richard Biener wrote: > >> > On Fri, 8 Jul 2016, Richard Biener wrote: > >> > > >> >> On Fri, 8 Jul 2016, Pratha

Re: fold x ^ y to 0 if x == y

2016-07-20 Thread Prathamesh Kulkarni
On 20 July 2016 at 23:07, Prathamesh Kulkarni wrote: > On 20 July 2016 at 16:35, Richard Biener wrote: >> On Wed, 20 Jul 2016, Prathamesh Kulkarni wrote: >> >>> On 8 July 2016 at 12:29, Richard Biener wrote: >>> > On Fri, 8 Jul 2016, Richard Biener wrote: >>> > >>> >> On Fri, 8 Jul 2016, Pratham

Re: fold x ^ y to 0 if x == y

2016-07-20 Thread Prathamesh Kulkarni
On 20 July 2016 at 16:35, Richard Biener wrote: > On Wed, 20 Jul 2016, Prathamesh Kulkarni wrote: > >> On 8 July 2016 at 12:29, Richard Biener wrote: >> > On Fri, 8 Jul 2016, Richard Biener wrote: >> > >> >> On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: >> >> >> >> > Hi Richard, >> >> > For the

Re: fold x ^ y to 0 if x == y

2016-07-20 Thread Jeff Law
On 07/20/2016 09:35 AM, Richard Biener wrote: I have reported it as PR71947. Could you help me point out how to fix this ? Not record both equivalences. This might break the testcase it was introduced for (obviously). Which is why I CCed Jeff for his opinion. It's on my todo list. I'm still

Re: fold x ^ y to 0 if x == y

2016-07-20 Thread Richard Biener
On Wed, 20 Jul 2016, Prathamesh Kulkarni wrote: > On 8 July 2016 at 12:29, Richard Biener wrote: > > On Fri, 8 Jul 2016, Richard Biener wrote: > > > >> On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: > >> > >> > Hi Richard, > >> > For the following test-case: > >> > > >> > int f(int x, int y) > >>

Re: fold x ^ y to 0 if x == y

2016-07-20 Thread Prathamesh Kulkarni
On 8 July 2016 at 12:29, Richard Biener wrote: > On Fri, 8 Jul 2016, Richard Biener wrote: > >> On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: >> >> > Hi Richard, >> > For the following test-case: >> > >> > int f(int x, int y) >> > { >> >int ret; >> > >> >if (x == y) >> > ret = x ^ y;

Re: fold x ^ y to 0 if x == y

2016-07-08 Thread Richard Biener
On Fri, 8 Jul 2016, Richard Biener wrote: > On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: > > > Hi Richard, > > For the following test-case: > > > > int f(int x, int y) > > { > >int ret; > > > >if (x == y) > > ret = x ^ y; > >else > > ret = 1; > > > >return ret; > >

Re: fold x ^ y to 0 if x == y

2016-07-08 Thread Richard Biener
On Fri, 8 Jul 2016, Prathamesh Kulkarni wrote: > Hi Richard, > For the following test-case: > > int f(int x, int y) > { >int ret; > >if (x == y) > ret = x ^ y; >else > ret = 1; > >return ret; > } > > I was wondering if x ^ y should be folded to 0 since > it's guarded

fold x ^ y to 0 if x == y

2016-07-08 Thread Prathamesh Kulkarni
Hi Richard, For the following test-case: int f(int x, int y) { int ret; if (x == y) ret = x ^ y; else ret = 1; return ret; } I was wondering if x ^ y should be folded to 0 since it's guarded by condition x == y ? optimized dump shows: f (int x, int y) { int iftmp.0_1;