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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Hongtao.liu from comment #4)
> > but yes, cselim will also sink the first store, moving it across the
> 
> Can we also sink loads?

loads are usually hoisted, not sunk.

> assign pointer to another temp pointer in both if
> and else bb, and then load val from this temp pointer. those assignments
> that in if and else branch would be finially transformed to conditional mov. 

Hmm, so conditional move is faster.  No, I don't think we'd do this at
the moment and I'm not sure we want in general (since aggressive
if-conversion tends to be bad).

> performance can benifit 100% with below change.
> 
>  for (i = 0; i < (1<<5)/2; i++) {
> 
>     esMetricIn = *pBranchMetric++;
> 
>     esMetric1 = pIn1->m_esPathMetric - esMetricIn;
>     esMetric2 = pIn2->m_esPathMetric + esMetricIn;
> 
>     e_s16 *t1p = (esMetric1 >= esMetric2) ? &(pIn1->m_esState) :
> &(pIn2->m_esState);
>     e_s16 t1  = (esMetric1 >= esMetric2) ? esMetric1 : esMetric2;
>     pOut->m_esPathMetric = t1;
>     pOut->m_esState = *t1p << 1;
>     pOut++;
> 
>     esMetric1 = pIn1->m_esPathMetric + esMetricIn;
>     esMetric2 = pIn2->m_esPathMetric - esMetricIn;
> 
>     e_s16 *t2p = (esMetric1 >= esMetric2) ? &(pIn1->m_esState) :
> &(pIn2->m_esState);
>     e_s16 t2  = (esMetric1 >= esMetric2) ? esMetric1 : esMetric2;
>     pOut->m_esPathMetric = t2;
>     pOut->m_esState = *t2p << 1;
>     pOut++;
> 
>     pIn1++;
>     pIn2++;
>   }

Reply via email to