[PATCH] D45321: [atomics] Fix runtime calls for misaligned atomics

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 5 15:51:27 PDT 2018


efriedma added a comment.

Yes, the situation around atomic instructions in IR is a bit of a mess.  Originally, the backend was required to reject instructions which wouldn't be lock-free, and all the documentation with that expectation.  But that changed later to start generating calls to __atomic_* instead, and I guess the documentation was never completely updated.

clang might also have a bug here?  I think I've seen it generate calls to __atomic_load_8 with a misaligned operand.



================
Comment at: compiler-rt/lib/builtins/atomic.c:158
         /* FIXME: __uint128_t isn't available on 32 bit platforms.
         LOCK_FREE_ACTION(__uint128_t);*/\
       }\
----------------
We also need to fix this FIXME, for correctness... if we have a 16-byte atomic store implementation, we need to use it.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45321





More information about the llvm-commits mailing list