Optimization of conditional access to globals: thread-unsafe?
Robert Dewar
dewar@adacore.com
Mon Oct 29 22:07:00 GMT 2007
skaller wrote:
> On Mon, 2007-10-29 at 21:03 +0100, Andi Kleen wrote:
>> On Mon, Oct 29, 2007 at 03:51:27PM -0400, Robert Dewar wrote:
>>> Sure, well nearly every optimization has some case where it is a
>>> pessimization (one interesting thing that happens is that if you
>>> change the length of generated code in *any* way you may be unlucky
>>> and cause a systematic instruction cache miss in a loop, inlining
>> icache misses are hard in general and agreed the compiler cannot
>> do too much about them (except for trying not to generate too bloated
>> code in general)
>
> BTW: doesn't this suggest unrolling loops and recursions is
> potentially expensive?
Yes, of course! unrolling loops is often an overall loss
>
More information about the Gcc
mailing list