[llvm-dev] [atomics][AArch64] Possible bug in cmpxchg lowering

Tim Northover via llvm-dev llvm-dev at lists.llvm.org
Tue May 30 15:40:33 PDT 2017


Hi Geoff,

On 30 May 2017 at 15:29, Geoff Berry via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
> GCC instead generates a ldaxr for the initial load, which seems more correct
> to me since it is honoring the requested failure case acquire ordering.  I'd
> like to get other opinions on this before filing a bug.

It's all a bit uncertain at the moment, as the C++ standard is at the
very least ambiguous (as is the LangRef). I think historically I
decided to interpret "no stronger than" to forbid a failure ordering
from having acquire semantics if the success ordering didn't (as in,
you can only drop requirements). I don't know if I ever convinced
anyone else of that (or even mentioned it to them) though.

But it looks like the constraints might well be relaxed in C++
(http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0418r2.html),
and I know at least some Swift people are keen on what you're
describing being valid.

So changing LLVM to do the same as GCC does seem like a decent idea to
me. But remember to update the LangRef to make it clear.

Cheers.

Tim.


More information about the llvm-dev mailing list