[PATCH] D17950: Implement is_always_lock_free
JF Bastien via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 16 16:09:38 PDT 2016
jfb added a comment.
In http://reviews.llvm.org/D17950#376349, @jyknight wrote:
> This conflicts with http://reviews.llvm.org/D17933. Most of this change also seems unnecessary.
>
> - I think the `is_always_lock_free` function should be defined based on the existing `__atomic_always_lock_free` builtin, not on defines (just like is_lock_free uses `__atomic_is_lock_free`, or `__c11_atomic_is_lock_free`, which is effectively an alias).
> - Then, the new `__GCC_ATOMIC_DOUBLE_LOCK_FREE` macros are unnecessary, unless we need to actually define a `ATOMIC_DOUBLE_LOCK_FREE` macro.
> - `__LLVM_ATOMIC_1_BYTES_LOCK_FREE` effectively duplicates `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1`, so aren't needed.
Hmm, when I originally wrote the paper I though I'd tried that. Can't remember why I went the other way, let me try out `__atomic_always_lock_free`. That would indeed be much simpler as it would be a pure libc++ change., thanks for raising the issue.
================
Comment at: lib/Frontend/InitPreprocessor.cpp:305
@@ +304,3 @@
+ if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
+ TypeWidth <= InlineWidth)
+ return Always;
----------------
bcraig wrote:
> On some targets (like Hexagon), 4-byte values are cheap to inline, but 1-byte values are not. Clang is spotty about checking this, but TargetInfo::hasBuiltinAtomic seems like the right function to ask, if you have access to it.
You're commenting on:
```
if (TypeWidth == TypeAlign && (TypeWidth & (TypeWidth - 1)) == 0 &&
TypeWidth <= InlineWidth)
```
?
Are you asking for a separate change, or for a change to my patch?
http://reviews.llvm.org/D17950
More information about the cfe-commits
mailing list