[PATCH] D86281: [compiler-rt][builtins] Tweak checks for lock-free atomics

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 04:59:34 PDT 2020


luismarques added inline comments.


================
Comment at: compiler-rt/lib/builtins/atomic.c:124
+/// Macros for determining whether a size is lock free.
+#define IS_LOCK_FREE_1 __atomic_always_lock_free(1, NULL)
+#define IS_LOCK_FREE_2 __atomic_always_lock_free(2, NULL)
----------------
arichardson wrote:
> Actually, I'm not sure if passing NULL is correct, can `__atomic_load` be called with an under-aligned pointer?
Good question. At the time when I reasoned about that issue I concluded that it was correct. I remember checking that the assembly ouput of compiling atomic.c didn't change at all for e.g. X86 (that doesn't prove anything for the general case, but it's still a good sanity check). But thinking again about it I think you may be right -- or maybe I'm just forgetting the reasons why I had concluded it was fine. It doesn't matter now :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86281



More information about the llvm-commits mailing list