This is the mail archive of the
mailing list for the GCC project.
Re: Optimization of conditional access to globals: thread-unsafe?
From: "Dave Korn" <email@example.com>
Date: Mon, 29 Oct 2007 02:39:15 -0000
> BTW, you and Tomash should get your stories in synch. He says
> speculative loads are ok, just no stores, and wants a kind of
> half-volatile flag that would only suppress stores. I think you're
> already looking one step further down the road than he is and have
> realised that speculative loads will give you problems too.
Probably speculative loads are OK, as long as function calls
to functions the compiler cannot see the complete implementation
of form an implicit boundary (ie. any memory might be modified)
which is happily does already.
In what cases those speculative loads are profitable is another
matter, given how expensive cache misses are compared to mispredicted