This is the mail archive of the
mailing list for the GCC project.
Re: -fno-tree-cselim not working?
From: Ian Lance Taylor <email@example.com>
Date: 25 Oct 2007 21:50:16 -0700
> We could have a global variable "lock_is_held". The
> code could look like this:
> if (lock_is_held)
> If the earlier code should work in a multi-threaded environment, then
> this code should work.
I think it should be disallowed for this code to write to memory if
lock_is_held is falso too.
When you conditionalize moves amongst registers, this is %100 local
execution state. But once you start conditionlizing memory
references, in particular things that write, you are asking for
I realize the desire to use conditional compututations on memory on
platforms that can do it, but in these circumstances it is simply
unreasonable to do so.
At best the compiler can, if it wants, conditionalize the store.
This is not a game or some fun theoretical discussion about language
semantics. People will be harmed and lose lots of their own personal
time debugging these kinds of things if GCC generates code like this.
It's unreasonable, regardless of what the standards say. Sometimes
the standards are wrong or fail to guide the implementation in these
grey areas, and GCC should do what's best for the users in these
cases. And I believe that this means to not do conditional
computations on memory even though it might be more efficient in some