[PATCH] D85044: Add __atomic_is_lock_free to compiler-rt

Louis Dionne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 3 09:07:51 PST 2020


ldionne added a comment.

In D85044#2427077 <https://reviews.llvm.org/D85044#2427077>, @oontvoo wrote:

> In D85044#2426999 <https://reviews.llvm.org/D85044#2426999>, @ldionne wrote:
>
>> I'm definitely naive w.r..t compiler-rt, but why is a simple approach like D92302 <https://reviews.llvm.org/D92302> not sufficient?
>
> The implementation there provides the *right* answers for the cases that can be determined statically.

Doesn't D92302 <https://reviews.llvm.org/D92302> also check for the alignment of the pointer? My understanding is that with D92302 <https://reviews.llvm.org/D92302>, we're returning `true` from `atomic_is_lock_free` whenever the implementation in compiler-rt, as of D92302 <https://reviews.llvm.org/D92302>, would be lockfree. Whether that's the very best we can do on the hardware is a different story -- but D92302 <https://reviews.llvm.org/D92302>'s `atomic_is_lockfree` will be consistent with the actual implementation. Am i mistaken?

So, basically, this patch does the above, but also allows using a lockfree implementation in more cases, is that it? I'm trying to figure out whether it makes sense to land D92302 <https://reviews.llvm.org/D92302>, and then this patch, since this one seems a lot more involved (and still has TODOs). Please let me know if I'm not getting this right, I'm a bit out of my depth trying to read this patch TBH.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85044/new/

https://reviews.llvm.org/D85044



More information about the llvm-commits mailing list