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

--- Comment #2 from Hongtao.liu <crazylht at gmail dot com> ---

>   cnt.1_7 = (unsigned char) cnt_21;
>   _8 = cnt.1_7 + 1;
>   cnt_16 = (char) _8;
>   cnt_9 = _3 == _6 ? cnt_16 : cnt_21;
>  

In tree_if_conversion, there's is_cond_scalar_reduction, i'm think to extend
the currect implementation to reduce bellow

      loop-header:
        cnt_21 = PHI <0, cnt_9>
      ...
        if (cond_expr)
          tmp1 = (unsigned type) cnt_21
          tmp2 = tmp1 +/- rhs2
          cnt_16 = (signed type) tmp2
        cnt_9 = PHI <cnt_16, cnt_21>

to 
     cnt_9 = PHI <0, cnt_21>
     tmp1 = (unsigned type)cnt_9;
     ifcvt = cond_expr ? rhs2 : 0
     tmp2 = tmp1 +/- ifcvt;
     cnt_21 = (signed type)tmp2;

I hope vectorizer reduction can handle the upper sequence.

Reply via email to