On Thu, 5 Jun 2014, Christian Bruel wrote:

> Hello,
> 
> while checking why a loop snippet like
> 
>   for (i = 0; i <= 5000; i++)
>     if (b)
>       a = 2;
>     else
>       a = x;
> 
> was not optimized in -O2 (unless loop unrolling or loop switching), I
> found out that the case was already  partially handled by Richard in
> PR43934. So this patch just adds a cost to the phi defs constants to
> allow the whole test to be hoisted out of the loop.
> 
> Richard, does this seem reasonable and OK for 4.10 ?

Ok with dropping the assert, constant-propagating cst_cost and
adding a comment like /* Assign const 1 to invariants.  */

Thanks,
Richard.

Reply via email to