PR 32044

Zdenek Dvorak rakdver@kam.mff.cuni.cz
Mon Feb 18 16:06:00 GMT 2008


Hi,

> This is the PR that causes code of the form
>         while (nsec >= NSEC_PER_SEC) {
>                 nsec -= NSEC_PER_SEC;
>                 ++sec;
>         }
> to be converted to a division by the tree loop optimizer.  That is a
> performance regression; we can assume that the code is written that way
> on purpose because the number of iterations is known to be small.  On
> targets where no hardware division is available it could easily be two
> orders of magnitude slower.  Despite that, and despite the fact that we
> know the revision that caused this, it's been languishing as a P4
> regression for months.
> 
> Reverting part of revision 122896, as in the patch below, cures the
> problem.  I propose to apply this before 4.3 is out.

what about the problems for that the patch was originally applied?  As
far as I remember, the expensiveness check caused a lot of missed
optimizations.  IMHO, a more careful approach is needed.

Perhaps we could just recognize this particular idiom of
division/remainder computation,

Zdenek



More information about the Gcc-patches mailing list