This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
- From: Andi Kleen <andi at firstfloor dot org>
- To: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 22 Oct 2007 20:11:34 +0200
- Subject: Re: Optimization of conditional access to globals: thread-unsafe?
- References: <20071022093617.GA5073@moonlight.home.suse.lists.egcs> <18204.31027.183382.838763@zebedee.pink.suse.lists.egcs> <20071022105044.GB5073@moonlight.home.suse.lists.egcs> <011501c8149b$b7156c20$2e08a8c0@CAM.ARTIMI.COM.suse.lists.egcs> <20071022111704.GE5073@moonlight.home.suse.lists.egcs> <011601c8149d$7050bea0$2e08a8c0@CAM.ARTIMI.COM.suse.lists.egcs> <20071022112643.GG5073@moonlight.home.suse.lists.egcs> <012501c814b2$f4623470$2e08a8c0@CAM.ARTIMI.COM.suse.lists.egcs> <20071022143215.GH5073@moonlight.home.suse.lists.egcs> <Pine.LNX.4.64.0710221757450.23011@wotan.suse.de.suse.lists.egcs> <20071022171757.GI5073@moonlight.home.suse.lists.egcs> <18204.57073.943880.741269@zebedee.pink.suse.lists.egcs>
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