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
Something like this perhaps: > > /* factor_out_conditional_conversion may create a new PHI in BB2 and >eliminate an existing PHI in BB2. Recompute values that may be >affected by that change. */ > > > Or something along those lines. Done. > > >> /*

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-07 Thread Jeff Law
tional_replacement (bb, bb1, e1, e2, phi, arg0, arg1)) cfgchanged = true; @@ -410,6 +422,133 @@ replace_phi_edge_with_variable (basic_block cond_block, bb->index); } +/* PR66726: Factor conversion out of COND_EXPR. If the arguments of the PHI + stmt are CONVERT_STMT, fact

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-07 Thread Kugan
ional_replacement, abs_replacement and minmax_replacement. > > >> } >> } >> >> @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block >> cond_block, >> bb->index); >> } >> >> +/* PR66726: Factor conversion

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-06 Thread Jeff Law
lacement, abs_replacement and minmax_replacement. } } @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block cond_block, bb->index); } +/* PR66726: Factor conversion out of COND_EXPR. If the arguments of the PHI + stmt are CONVERT_STMT, factor out t

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Bernhard Reutner-Fischer
conditional_conversion. >> >>> diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c >>> index d2a5cee..e8af086 100644 >>> --- a/gcc/tree-ssa-phiopt.c >>> +++ b/gcc/tree-ssa-phiopt.c >> >>> @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block >

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Kugan
> >> diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c >> index d2a5cee..e8af086 100644 >> --- a/gcc/tree-ssa-phiopt.c >> +++ b/gcc/tree-ssa-phiopt.c > >> @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block cond_block, >>bb->ind

Re: [PR66726] Factor conversion out of COND_EXPR

2015-07-04 Thread Bernhard Reutner-Fischer
pt_worker): Call factor_out_conditional_conversion. > diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c > index d2a5cee..e8af086 100644 > --- a/gcc/tree-ssa-phiopt.c > +++ b/gcc/tree-ssa-phiopt.c > @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block cond_block,

[PR66726] Factor conversion out of COND_EXPR

2015-07-03 Thread Kugan
nditional_conversion (e1, e2, phi, arg0, arg1)) + cfgchanged = true; } } @@ -410,6 +413,108 @@ replace_phi_edge_with_variable (basic_block cond_block, bb->index); } +/* PR66726: Factor conversion out of COND_EXPR. If the argument of the PHI + stmt are CON