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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So the point is that P is invariant but we do not hoist it because it's
computed in a (estimated) cold block?  I notice that the condition is
invariant, too, so
in principle we could hoist as

  if (d > 0.01)
    P = ( W < E ) ? (W - E)/d : (E - W)/d;
  for (i=0; i < 2; i++ )
    if( d > 0.01 )
      F[i] += P;

alternatively one might argue that invariant expressions (unconditionally
computed or in a special way under invariant conditions) should be costed
differently.

I think best would be to restore the original intent of the testcase which
was added with the fix for PRs 23109, 23948 and 24123.  I suppose there
we saw the invariant hoisted(?) and the loop unrolled so I would suggest
to either apply the hoisting or the unrolling manually to the testcase.
(just look at the PRs whether you get a better idea of the origin of the
testcase).

Reply via email to