> From: Richard Guenther [mailto:richard.guent...@gmail.com]
> Can we _remove_ a store we percieve as redundant (with a single-threaded
> view) with the memory model?
Generally yes, so long as synchronization operations either conservatively 
treated as completely opaque, or are treated correctly in the "single-threaded 
view".  If there is no synchronization between the original store, and the 
redundant one, then the redundant one changes things only if another thread 
writes to the same variable in-between.  That constitutes a data race, which 
invokes undefined behavior.  The general rule is that any sequentially correct 
transformation is OK between synchronization operations, so long as you don't 
store to anything you weren't supposed to modify, and the state at the next 
synchronization point is what would have been expected.  You can sometimes 
treat synchronizations more aggressively, but that should be safe.

Hans

Reply via email to