On 21/02/13 15:59, Andi Kleen wrote:
That doesn't sound enough, unless there is already code out there
that respects this count. 1000 at 4 bytes per instruction is only
4k. More that small enough for the rest of the compiler to think
that it could jump around such blocks cheaply.
I think a limit of 1M or more might be more appropriate.
I got an overflow for 6.4M, so 1M would be dangerously near that.
100k perhaps ?
This was not for jump shortening, but the inliner heuristics.
My mistake. However, the real problem here is that you're summing a
potentially large number of items on the expectation that the result
will be small enough to be scaled successfully by the weight function.
A better patch would be to a apply a much larger limit at the time when
the count of instructions is finally used, rather than picking some
arbitrary number here in the hope that it won't cause overflow later on.
Yes, that's a bigger patch, but it would be a more robust solution than
picking an arbitrary number here.
In the worst case we could separate the two, would be a larger
patch though.
-Andi