Hi, On Wed, 25 Nov 2015, Jakub Jelinek wrote:
> > That looks bogus to me. It misses asm()s and at least today > > nonfreeing_call_p too much checks what it sounds like it checks. In > > practice it might work though. At least all the __sync_* and > > __atomic_* calls are _not_ barriers this way. A pthread_mutex_lock is > > though as we don't have a builtin for it. > > > > I'd change the above to a conservative > > > > if ((is_gimple_call (stmt) || is_gimple_asm (stmt)) && gimple_vuse > > (stmt)) > > nonfreeing_call_p is one necessary condition (if that is true, it means > the call could mean that the first access does not trap while the second one > does). Yes, Richis test is conservatively catching this as well (it's clear the table for all calls and asms that even remotely can change memory state (well, when using gimple_vdef, not gimple_vuse). Ciao, Michael.