http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57223

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Usishchev Yury from comment #3)
> I'm testing it on current trunk, and second loop is not vectorized both with
> floating point and integer types.
> For floating point types it is not vectorized due to control flow in loop:
> 
>  <bb 15>:
> // ...
> if (t_56 > _61)
>   goto <bb 16>;
> else
>   goto <bb 17>;
>  <bb 16>:
>  <bb 17>:
> # iftmp.2_7 = PHI <_61(16), t_56(15)>
> 
> This can be optimized to MIN_EXPR in phiopt pass, but is not because of NaNs:
> 
> tree-ssa-phiopt.c:876:
>   /* The optimization may be unsafe due to NaNs.  */
>   if (HONOR_NANS (TYPE_MODE (type)))
>     return false;
> 
> If compiled with -ffinite-math-only second loop still is not vectorised:
> 
> not_always_good.c:16:7: note: not vectorized: latch block not empty.
> 
> (same occurs with integer types). Latch block it that case is:
> 
>  <bb 14>:
>   pretmp_176 = *prephitmp_173;
>   goto <bb 13>;
> 
> the statement here is generated in pre pass.
> 
> For vectorization to work we can either not generate it in pre or move it
> into head of the loop in vectorizer.
> 
> Right now i'm trying to find how to prevent pre from generating statements
> in empty latch blocks.

It already has code to avoid this in some situations.

Reply via email to