[libcxx-commits] [libcxx] 0f81598 - [libc++] Add a 'is-lockfree-runtime-function' lit feature

Alex Richardson via libcxx-commits libcxx-commits at lists.llvm.org
Tue Dec 22 03:58:37 PST 2020


Author: Alex Richardson
Date: 2020-12-22T11:56:20Z
New Revision: 0f81598cc1f46b9919b3500d7c4743dd7a5eac1a

URL: https://github.com/llvm/llvm-project/commit/0f81598cc1f46b9919b3500d7c4743dd7a5eac1a
DIFF: https://github.com/llvm/llvm-project/commit/0f81598cc1f46b9919b3500d7c4743dd7a5eac1a.diff

LOG: [libc++] Add a 'is-lockfree-runtime-function' lit feature

On macOS 10.14 /usr/lib/system/libcompiler_rt.dylib contains all the
`__atomic_load*`, etc. functions but does not include the `__atomic_is_lock_free`
function. The lack of this function causes the non-lockfree-atomics feature
to be set to false even though large atomic operations are actually
supported, it's just the is_lock_free() function that is missing.

This is required so that the !non-lockfree-atomics feature can be used
to XFAIL tests that require runtime library support (D88818).

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D91911

Added: 
    

Modified: 
    libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp
    libcxx/utils/libcxx/test/features.py

Removed: 
    


################################################################################
diff  --git a/libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp b/libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp
index ebe8fc82775c..96a34e22069c 100644
--- a/libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp
+++ b/libcxx/test/libcxx/atomics/atomics.align/align.pass.pass.cpp
@@ -7,7 +7,7 @@
 //===----------------------------------------------------------------------===//
 //
 // UNSUPPORTED: libcpp-has-no-threads, c++03
-// REQUIRES: non-lockfree-atomics
+// REQUIRES: is-lockfree-runtime-function
 
 // GCC currently fails because it needs -fabi-version=6 to fix mangling of
 // std::atomic when used with __attribute__((vector(X))).

diff  --git a/libcxx/utils/libcxx/test/features.py b/libcxx/utils/libcxx/test/features.py
index 3023caeea5d3..a435a938fdcd 100644
--- a/libcxx/utils/libcxx/test/features.py
+++ b/libcxx/utils/libcxx/test/features.py
@@ -55,7 +55,16 @@
             #include <atomic>
             struct Large { int storage[100]; };
             std::atomic<Large> x;
-            int main(int, char**) { return x.load(), x.is_lock_free(); }
+            int main(int, char**) { (void)x.load(); return 0; }
+          """)),
+  # TODO: Remove this feature once compiler-rt includes __atomic_is_lockfree()
+  # on all supported platforms.
+  Feature(name='is-lockfree-runtime-function',
+          when=lambda cfg: sourceBuilds(cfg, """
+            #include <atomic>
+            struct Large { int storage[100]; };
+            std::atomic<Large> x;
+            int main(int, char**) { return x.is_lock_free(); }
           """)),
 
   Feature(name='apple-clang',                                                                                                      when=_isAppleClang),


        


More information about the libcxx-commits mailing list