dvyukov added a comment. Will this optimization transform: int foo() { int r = atomic_load_n(&x, __ATOMIC_RELAXED); atomic_store_n(&x, r+1, __ATOMIC_RELAXED); return r; } ? If yes, how? http://reviews.llvm.org/D11382