Re: [PR66726] Factor conversion out of COND_EXPR

2015-08-03 Thread Jeff Law
On 07/26/2015 07:05 PM, Kugan wrote: I thought that when !gimple_assign_cast_p (stmt), RHS will always boolean. I have now added this check in the attached patch. Thanks. I also noticed that in maybe_optimize_range_tests, GIMPLE_COND can have non compatible types when new_op is updated (bool

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-26 Thread Kugan
On 24/07/15 05:05, Jeff Law wrote: > On 07/15/2015 11:52 PM, Kugan wrote: >> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 932c83a..3058eb5 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c >>> return false; bb = g

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-23 Thread Jeff Law
On 07/15/2015 11:52 PM, Kugan wrote: diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c index 932c83a..3058eb5 100644 --- a/gcc/tree-ssa-reassoc.c +++ b/gcc/tree-ssa-reassoc.c return false; bb = gimple_bb (stmt); if (!single_succ_p (bb)) @@ -2729,9 +2743,8 @@ fina

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-15 Thread Kugan
>> >> diff --git a/gcc/tree-ssa-reassoc.c b/gcc/tree-ssa-reassoc.c >> index 932c83a..3058eb5 100644 >> --- a/gcc/tree-ssa-reassoc.c >> +++ b/gcc/tree-ssa-reassoc.c > >> return false; >> bb = gimple_bb (stmt); >> if (!single_succ_p (bb)) >> @@ -2729,9 +2743,8 @@ final_range_test_p (g

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-15 Thread Jeff Law
On 07/15/2015 01:09 AM, Kugan wrote: 2015-07-15 Kugan Vivekanandarajah PR middle-end/66726 * tree-ssa-reassoc.c (optimize_range_tests): Handle sinking the cast after PHI. (final_range_test_p): Detect sinking the cast after PHI. (maybe_optimize_range_tests): Hand

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-15 Thread Kugan
Here is a patch to fix to teach tree-ssa-reassoc the sinking the cast. Bootstrapped and regression tested on x86-64-none-linux-gnu with no new regressions. Also regression tested on qemu arm. I also verified the issue Andreas Schwab raised is fixed on arm cortex-a5 where the same issue was presen

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-12 Thread Kugan
On 11/07/15 06:40, Jeff Law wrote: > On 07/09/2015 05:08 PM, Kugan wrote: > >> Done. Bootstrapped and regression tested on x86-64-none-linux-gnu with >> no new regressions. Is this OK for trunk? > Thanks for the additional testcases. > > > >> + else >> +{ >> + /* If arg1 is an INTEG

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-10 Thread Jeff Law
On 07/09/2015 05:08 PM, Kugan wrote: Done. Bootstrapped and regression tested on x86-64-none-linux-gnu with no new regressions. Is this OK for trunk? Thanks for the additional testcases. + else +{ + /* If arg1 is an INTEGER_CST, fold it to new type. */ + if (INTEGRAL_TYPE_P

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-09 Thread Kugan
On 08/07/15 00:41, Jeff Law wrote: > On 07/07/2015 06:50 AM, Kugan wrote: >> >> Thanks for the review. I have addressed your comments above in the >> attached patch. >> >> I have one question with respect to unary operation. For generic unary >> operation with INTEGER_CST, do we skip this or do w

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-07 Thread Jeff Law
On 07/07/2015 06:50 AM, Kugan wrote: Thanks for the review. I have addressed your comments above in the attached patch. I have one question with respect to unary operation. For generic unary operation with INTEGER_CST, do we skip this or do we have to perform the inverse operation so that the c

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-07 Thread Kugan
On 07/07/15 07:37, Jeff Law wrote: > On 07/04/2015 06:32 AM, Kugan wrote: > I would also verify that this turns into a MIN_EXPR. I think the patch > as-written won't detect the MIN_EXPR until the _next_ time phi-opt is > called. And one of the benefits we're really looking for here is to > remov

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-06 Thread Jeff Law
On 07/04/2015 06:32 AM, Kugan wrote: p.txt diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr66726.c b/gcc/testsuite/gcc.dg/tree-ssa/pr66726.c index e69de29..93f1ace 100644 --- a/gcc/testsuite/gcc.dg/tree-ssa/pr66726.c +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr66726.c @@ -0,0 +1,13 @@ + +/* { dg-do c

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Bernhard Reutner-Fischer
On July 4, 2015 2:32:11 PM GMT+02:00, Kugan wrote: >On 04/07/15 18:51, Bernhard Reutner-Fischer wrote: >> On Sat, Jul 04, 2015 at 12:58:58PM +1000, Kugan wrote: >>> Please find a patch that attempt to FIX PR66726 by factoring >conversion >>> out of COND_EXPR as explained in the PR. >>> >>> Bootst

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Kugan
On 04/07/15 18:51, Bernhard Reutner-Fischer wrote: > On Sat, Jul 04, 2015 at 12:58:58PM +1000, Kugan wrote: >> Please find a patch that attempt to FIX PR66726 by factoring conversion >> out of COND_EXPR as explained in the PR. >> >> Bootstrapped and regression tested on x86-64-none-linux-gnu with n

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Bernhard Reutner-Fischer
On Sat, Jul 04, 2015 at 12:58:58PM +1000, Kugan wrote: > Please find a patch that attempt to FIX PR66726 by factoring conversion > out of COND_EXPR as explained in the PR. > > Bootstrapped and regression tested on x86-64-none-linux-gnu with no new > regressions. Is this OK for trunk? > > Thanks,