Optimization of conditional access to globals: thread-unsafe?

Andi Kleen andi@firstfloor.org
Mon Oct 22 18:11:00 GMT 2007


Andrew Haley <aph-gcc@littlepinkcloud.COM> writes:

> Tomash Brechko writes:
>
>  > 
>  > Several people already suggested to use volatile for shared data.
>  > Yes, it will help because we know it will disable all access
>  > optimizations, including thread-unaware ones.  But I don't want to
>  > disable _all_ optimizations, I rather vote for thread-aware
>  > optimizations.
>
> But your plan would disable optimizations even when it isn't necessary
> to do so.  Only a small part of the data in a multi-threaded program
> are shared.

At least for current x86 it is dubious the cmov change on memory was actually
an improvement.

-Andi



More information about the Gcc mailing list