diff options
author | Gokturk Yuksek <gokturk@binghamton.edu> | 2020-02-17 18:36:18 +0000 |
---|---|---|
committer | Luís Marques <luismarques@lowrisc.org> | 2020-02-17 18:53:41 +0000 |
commit | cef85193b2cc1817ca43199a0ae9c6f25723997d (patch) | |
tree | 0a3de6e1c6af5bd9548179a06159f003c5053f0b /clang/lib/Serialization/ModuleManager.cpp | |
parent | 0e2eb357e0471bbac81f18097e5ad761ae1431f0 (diff) | |
download | llvm-cef85193b2cc1817ca43199a0ae9c6f25723997d.zip llvm-cef85193b2cc1817ca43199a0ae9c6f25723997d.tar.gz llvm-cef85193b2cc1817ca43199a0ae9c6f25723997d.tar.bz2 |
[CMake] CheckAtomic.cmake: catch false positives in RISC-V
The check for 'HAVE_CXX_ATOMICS_WITHOUT_LIB' may create false
positives in RISC-V. This is reproducible when compiling LLVM natively
using GCC on a rv64gc (rv64imafdgc) host. Due to the 'A' (atomic)
extension, g++ replaces calls to libatomic operations on the
std::atomic<int> type with the native hardware instructions. As a
result, the compilation succeeds and the build system thinks it
doesn't need to pass '-latomic'.
Improve the reliability of the 'HAVE_CXX_ATOMICS_WITHOUT_LIB' test in
two steps:
1. Force a pre-increment on x (++x), which should force a call to a
libatomic function;
2. Because step 1 would resolve the increment to 'amoadd.w.aq' under
the 'A' extension, force the same operation on sub-word types, for
which there is no hardware support.
Reviewers: jfb, hintonda, smeenai, mgorny, JDevlieghere, jyknight
Reviewed By: jfb
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D68964
Diffstat (limited to 'clang/lib/Serialization/ModuleManager.cpp')
0 files changed, 0 insertions, 0 deletions