https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117088

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Andrew Macleod from comment #4)
...
> Its never been clear ot me why we still change loop branches to use !=. We
> turn  
>   for (int y = 0 ; y < 10; y++)  
>     b[y] = x;
> into
> 
>   if (y_1 != 10)
>     goto <bb 3>; [INV]
>   else
>     goto <bb 5>; [INV]
> 
> and as a result, range analysis only picks up that y_1 is not 10.  whereas
> if that had remained 
>   if (y_1 < 10)
>     goto <bb 3>; [INV]
>   else
>     goto <bb 5>; [INV]
> 
> we'd at least have picked up y_1 is [-INF, 9] at in BB3 instead of
> [-INF,9[11, +INF]
> Instead, it has to depend on loop analysis to find values that could just be
> apparent.

It's probably a misguided optimization thinking that != is cheaper.  It
possibly is when it's != 0 as compared to < 0 for a decrement IV and
the decrement is flag setting.  IIRC we do this adjustment as part of
VRP folding itself, right?

I'd be fine dropping this (next stage1, that is).

Reply via email to