> >> > >> I've updated the patch (as attached) to use sreal to compute badness. > >>>> + badness = ((int)((double) edge->count / max_count > >>>> + * relbenefit / RELATIVE_TIME_BENEFIT_RANGE * INT_MIN / 2)) / growth; > >>>> + > >>> > >>> FP operations on the host are frowned upon if code generation depends > >>> on their outcome. They all should use sreal_* as predict already does. > >>> Other than that I wonder why the final division is int (so we get > >>> truncation > >>> and not rounding)? That increases the effect of doing the multiply by > >>> relbenefit in double. Sorry, i missed this patch - I need to update my scripts marking files interesting to me.
I originally duplicated the trick from global.c that used to do this for ages. The rationale is that if you do only one FP operation, then you will not get difference in between hosts doing 80bit fp (x86) and 64bit fp (others) and you do the operation a lot faster than sreal does. While this is on slipperly ground, controlled use of double should not imply host dependency. Badness computation is on hot the path of inliner that is the slowest WPA optimization we have (well becuase it only does something realy useful). I suppose I can try to get Martin to benchmark the patch on firefox on the afternoon. Honza > >>> > >>> Richard. > >>> > >>>> /* Be sure that insanity of the profile won't lead to increasing > >>>> counts > >>>> in the scalling and thus to overflow in the computation above. */ > >>>> gcc_assert (max_count >= edge->count);