[PATCH] Disable use of std::call_once on OpenBSD with libstdc++

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 23 17:58:07 PDT 2016


On Sun, Oct 23, 2016 at 10:15:37PM +0200, Joerg Sonnenberger via llvm-commits wrote:
> On Sat, Oct 15, 2016 at 04:46:19PM -0400, Brad Smith via llvm-commits wrote:
> > Disable the use of std::call_once on OpenBSD with libstc++. It was noticed this caused
> > performance regressions and deadlocks.
> 
> I'd prefer to reorder this somewhat to make it clear what is tested:
> 
> LLVM_ON_UNIX && (LIBCPP_VERSION || !(NetBSD || OpenBSD || ppc)).
> 
> and invert the comment accordingly, e.g. "std::call_once from libc++ is
> used on all Unix platforms. Other implementations like libstdc++ are
> known to have problems on NetBSD, OpenBSD and PowerPC."
> 
> This is a change on PPC, but it seems to match the intention.
 
An updated patch is attached.

I created a PR as requested, PR30768.
-------------- next part --------------
Index: include/llvm/Support/Threading.h
===================================================================
--- include/llvm/Support/Threading.h	(revision 284932)
+++ include/llvm/Support/Threading.h	(working copy)
@@ -20,11 +20,11 @@
 #include <ciso646> // So we can check the C++ standard lib macros.
 #include <functional>
 
-// We use std::call_once on all Unix platforms except for NetBSD with
-// libstdc++. That platform has a bug they are working to fix, and they'll
-// remove the NetBSD checks once fixed.
-#if defined(LLVM_ON_UNIX) &&                                                   \
-    !(defined(__NetBSD__) && !defined(_LIBCPP_VERSION)) && !defined(__ppc__)
+// std::call_once from libc++ is used on all Unix platforms. Other
+// implementations like libstdc++ are known to have problems on NetBSD,
+// OpenBSD and PowerPC.
+#if defined(LLVM_ON_UNIX) && (defined(_LIBCPP_VERSION) ||                      \
+    !(defined(__NetBSD__) || defined(__OpenBSD__) || defined(__ppc__)))
 #define LLVM_THREADING_USE_STD_CALL_ONCE 1
 #else
 #define LLVM_THREADING_USE_STD_CALL_ONCE 0


More information about the llvm-commits mailing list