------- Comment #1 from ubizjak at gmail dot com 2008-12-17 08:56 ------- There are various scary comments in ifcvt.c, noce_process_if_block() regarding memory operands, like:
/* Only operate on register destinations, and even then avoid extending the lifetime of hard registers on small register class machines. */ and /* Don't operate on sources that may trap or are volatile. */ and /* Avoid store speculation: given "if (...) x = a" where x is a MEM, we only want to do the store if x is always set somewhere in the function. This avoids cases like if (pthread_mutex_trylock(mutex)) ++global_variable; where we only want global_variable to be changed if the mutex is held. FIXME: This should ideally be expressed directly in RTL somehow. */ I don't think it is always safe to simplify global memory operands. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38544