[PATCH] IR support for "cmpxchg weak"

Tim Northover t.p.northover at gmail.com
Fri Jun 13 06:47:54 PDT 2014

Hi Hal,

>> This patch is minimal, in the sense that it exposes some interfaces
>> to make "cmpxchg weak" usable, but doesn't actually do anything with
>> them. It comes with a similarly minimal Clang patch that just makes
>> it correctly use the strong cmpxchg again.
> This somewhat concerns me... does this make 'weak' the new default? If
> that is not backward compatible then maybe we should flip the default?

Strong is still the default.

The only way to create a weak AtomicCmpXchgInst at the moment is to
explicitly call "setWeak(true)" on an existing one (similarly to
setVolatile). Also, with this patch even a real "cmpxchg weak"
generates code identical to the strong variant, though I intend to
change that very soon. It's very conservative in that sense.



More information about the llvm-commits mailing list