[PATCH] D12338: Make `llvm::expandAtomicRMWToCmpXchg`'s initial load atomic.

Robin Morisset via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 31 17:07:45 PDT 2015


morisset added a reviewer: reames.
morisset added a subscriber: reames.
morisset added a comment.

After thinking some more about it, I realized that having the load stay non-atomic is actually unsound because there might be a race, which would make it undefined behaviour.
Sadly, making it monotonic would still introduce these redundant cmpxchg8b/16b since monotonic requires the access to be atomic.
I don't know well enough the semantics of unordered accesses to know if they would do the trick, and the llvm reference manual description of them is fairly lightweight on details.

@reames: do you know if unordered has the right strength for allowing races without forcing the backend to use cmpxchg8b/16b instead of two mov ? If no, do you have a better suggestion ?


http://reviews.llvm.org/D12338





More information about the llvm-commits mailing list