[PATCH] D51817: Do not use optimized atomic libcalls for misaligned atomics.
Eli Friedman via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 7 16:39:22 PDT 2018
efriedma accepted this revision.
efriedma added a comment.
This revision is now accepted and ready to land.
LGTM
================
Comment at: lib/CodeGen/CGAtomic.cpp:949
case AtomicExpr::AO__opencl_atomic_compare_exchange_strong:
case AtomicExpr::AO__atomic_load_n:
case AtomicExpr::AO__atomic_store_n:
----------------
rsmith wrote:
> efriedma wrote:
> > Is there any particular reason to expect that the pointer operand to __atomic_load_n can't be misaligned? I mean, for most ABIs, integers are naturally aligned, but that isn't actually a hard rule.
> `__atomic_load_n` is, by definition, guaranteed to never call an unoptimized atomic library function (see https://gcc.gnu.org/wiki/Atomic/GCCMM/LIbrary). [I think the purpose of the `..._n` variants is to provide builtins that libatomic's unoptimized library functions can use and have a guarantee that they will not be recursively re-entered.]
Oh, okay, makes sense.
Repository:
rC Clang
https://reviews.llvm.org/D51817
More information about the cfe-commits
mailing list