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

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 13 11:46:14 PDT 2018


efriedma added a comment.

The Linux libatomic __atomic_is_lock_free returns false for unaligned pointers, even on x86.  clang must generate code which is compatible with that, so it *cannot* inline misaligned atomic operations.  Given that clang can't inline misaligned atomic operations anyway, I don't see any compelling reason for compiler-rt to try to lower misaligned atomics using lock-free operations.

Not that's it's really relevant, but for the testcase in https://bugzilla.redhat.com/show_bug.cgi?id=1565766#c4 , clang should assume the pointer is aligned: it's undefined behavior to produce an int* which isn't 4-byte aligned.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D45321





More information about the llvm-commits mailing list