summaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Threading.cpp
AgeCommit message (Collapse)Author
2025-10-03Reland "[LLVM] Add GNU make jobserver support (#145131)"Yaxun (Sam) Liu
With fix for JobServerTest where default parallel scheduling strategy is saved/restored.
2025-10-03Revert "[LLVM] Add GNU make jobserver support (#145131)"Yaxun (Sam) Liu
revert this patch due to failure in unittests/Support, e.g. https://lab.llvm.org/buildbot/#/builders/33/builds/24178/steps/6/logs/FAIL__LLVM-Unit__SupportTests_61 This reverts commit ffc503edd0a2d07121232fe204e480fc29631a90.
2025-10-03[LLVM] Add GNU make jobserver support (#145131)Yaxun (Sam) Liu
This patch introduces support for the jobserver protocol to control parallelism for device offloading tasks. When running a parallel build with a modern build system like `make -jN` or `ninja -jN`, each Clang process might also be configured to use multiple threads for its own tasks (e.g., via `--offload-jobs=4`). This can lead to an explosion of threads (N * 4), causing heavy system load, CPU contention, and ultimately slowing down the entire build. This patch allows Clang to act as a cooperative client of the build system's jobserver. It extends the `--offload-jobs` option to accept the value 'jobserver'. With the recent addition of jobserver support to the Ninja build system, this functionality now benefits users of both Make and Ninja. When `--offload-jobs=jobserver` is specified, Clang's thread pool will: 1. Parse the MAKEFLAGS environment variable to find the jobserver details. 2. Before dispatching a task, acquire a job slot from the jobserver. If none are available, the worker thread will block. 3. Release the job slot once the task is complete. This ensures that the total number of active offload tasks across all Clang processes does not exceed the limit defined by the parent build system, leading to more efficient and controlled parallel builds. Implementation: - A new library, `llvm/Support/Jobserver`, is added to provide a platform-agnostic client for the jobserver protocol, with backends for Unix (FIFO) and Windows (semaphores). - `llvm/Support/ThreadPool` and `llvm/Support/Parallel` are updated with a `jobserver_concurrency` strategy to integrate this logic. - The Clang driver and linker-wrapper are modified to recognize the 'jobserver' argument and enable the new thread pool strategy. - New unit and integration tests are added to validate the feature.
2024-11-20[Support] Remove unused includes (NFC) (#116752)Kazu Hirata
Identified with misc-include-cleaner.
2023-07-19Define llvm::thread::DefaultStackSize to 4 megabytes on AIXWael Yehia
Link time thinLTO spawns pthreads to parallelize optimization and codegen of the input bitcode files. On AIX, the default pthread stack size limit is ~192k for 64-bit programs; insufficient for a normal LLVM compilation. Reviewed By: ZarkoCA, MaskRay Differential Revision: https://reviews.llvm.org/D155731
2022-12-18Include <optional> instead of "llvm/ADT/Optional.h"Kazu Hirata
This is part of an effort to migrate from llvm::Optional to std::optional: https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-16[Support] llvm::Optional => std::optionalFangrui Song
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
2022-12-01Threading: Convert Optional to std::optionalFangrui Song
dthorn: Relanding after fix-forward.
2022-12-01Revert "Threading: Convert Optional to std::optional"Daniel Thornburgh
This reverts commit 5e50b8089aee249d77542ea858d956568ec6581f. This commit breaks the build for BOLT: bolt/lib/Profile/DataAggregator.cpp:264:66: error: no viable conversion from 'Optional<StringRef>[3]' to 'ArrayRef<std::optional<StringRef>>'
2022-12-01Threading: Convert Optional to std::optionalFangrui Song
2022-11-29[Support] Move getHostNumPhysicalCores to Threading.hArchibald Elliott
This change is focussed on simplifying `Support/Host.h` to only do target detection. In this case, this function is close in usage to existing functions in `Support/Threading.h`, so I moved it into there. The function is also renamed to `llvm::get_physical_cores()` to match the style of threading's functions. The big change here is that now if you have threading disabled, `llvm::get_physical_cores()` will return -1, as if it had not been able to work out the right info. This is due to how Threading.cpp includes OS-specific code/headers. This seems ok, as if threading is disabled, LLVM should not need to know the number of physical cores. Differential Revision: https://reviews.llvm.org/D137836
2022-11-25Revert "[Support] Move getHostNumPhysicalCores to Threading.h"Florian Hahn
This reverts commit 5577207d6d3e0642ea047a8dfbfcf3ad372a7f25. This breaks building LLVM on recent macOS. Error messages below: llvm/lib/Support/Threading.cpp:190:3: error: use of undeclared identifier 'sysctlbyname' sysctlbyname("hw.physicalcpu", &count, &len, NULL, 0); ^ llvm/lib/Support/Threading.cpp:193:13: error: use of undeclared identifier 'CTL_HW' nm[0] = CTL_HW; ^ llvm/lib/Support/Threading.cpp:194:13: error: use of undeclared identifier 'HW_AVAILCPU' nm[1] = HW_AVAILCPU; ^ llvm/lib/Support/Threading.cpp:195:5: error: use of undeclared identifier 'sysctl' sysctl(nm, 2, &count, &len, NULL, 0); ^
2022-11-25[Support] Move getHostNumPhysicalCores to Threading.hArchibald Elliott
This change is focussed on simplifying `Support/Host.h` to only do target detection. In this case, this function is close in usage to existing functions in `Support/Threading.h`, so I moved it into there. The function is also renamed to `llvm::get_physical_cores()` to match the style of threading's functions. Differential Revision: https://reviews.llvm.org/D137836
2022-11-23Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreadsFangrui Song
Windows computeHostNumPhysicalCores is defined by Threading.cpp. Leave it unchanged.
2022-11-23Revert "Host: Internalize ↵Fangrui Song
computeHostNumPhysicalCores/computeHostNumHardwareThreads" This reverts commit 9969ceb36b440eaafa17c486f29a69c7a7da3b3b. On Windows: lld-link: error: undefined symbol: int __cdecl computeHostNumPhysicalCores(void) >>> referenced by LLVMSupport.lib(Support.Host.obj):(int __cdecl llvm::sys::getHostNumPhysicalCores(void))
2022-11-23Host: Internalize computeHostNumPhysicalCores/computeHostNumHardwareThreadsFangrui Song
2022-08-20Remove redundant initialization of Optional (NFC)Kazu Hirata
2022-08-08[Support] move llvm::llvm_is_multithread to header, NFCJun Zhang
This allow optimization without LTO. Also remove some useless else-ifs. Signed-off-by: Jun Zhang <jun@junz.org> Differential Revision: https://reviews.llvm.org/D131313
2021-07-09[Support] reorder Threading includes to avoid conflict with FreeBSD headersTim Northover
FreeBSD's condvar.h (included by user.h in Threading.inc) uses a "struct thread" that conflicts with llvm::thread if both are visible when it's included. So this moves our #include after the FreeBSD code.
2021-07-08Recommit: Support: add llvm::thread class that supports specifying stack size.Tim Northover
This adds a new llvm::thread class with the same interface as std::thread except there is an extra constructor that allows us to set the new thread's stack size. On Darwin even the default size is boosted to 8MB to match the main thread. It also switches all users of the older C-style `llvm_execute_on_thread` API family over to `llvm::thread` followed by either a `detach` or `join` call and removes the old API. Moved definition of DefaultStackSize into the .cpp file to hopefully fix the build on some (GCC-6?) machines.
2021-07-08Revert "Support: add llvm::thread class that supports specifying stack size."Tim Northover
It's causing build failures because DefaultStackSize isn't defined everywhere it should be and I need time to investigate.
2021-07-08Support: add llvm::thread class that supports specifying stack size.Tim Northover
This adds a new llvm::thread class with the same interface as std::thread except there is an extra constructor that allows us to set the new thread's stack size. On Darwin even the default size is boosted to 8MB to match the main thread. It also switches all users of the older C-style `llvm_execute_on_thread` API family over to `llvm::thread` followed by either a `detach` or `join` call and removes the old API.
2020-04-24[llvm-cov] Prevent llvm-cov from using too many threadsAlexandre Ganea
As reported here: https://reviews.llvm.org/D75153#1987272 Before, each instance of llvm-cov was creating one thread per hardware core, which wasn't needed probably because the number of inputs were small. This was probably causing a thread rlimit issue on large core count systems. After this patch, the previous behavior is restored (to what was before rG8404aeb5): If --num-threads is not specified, we create one thread per input, up to num.cores. When specified, --num-threads indicates any number of threads, with no upper limit. Differential Revision: https://reviews.llvm.org/D78408
2020-03-28After 09158252f777c2e2f06a86b154c44abcbcf9bb74, fix build when ↵Alexandre Ganea
-DLLVM_ENABLE_THREADS=OFF Tested on Linux with Clang 9, and on Windows with Visual Studio 2019 16.5.1 with -DLLVM_ENABLE_THREADS=ON and OFF.
2020-03-27[ThinLTO] Allow usage of all hardware threads in the systemAlexandre Ganea
Before this patch, it wasn't possible to extend the ThinLTO threads to all SMT/CMT threads in the system. Only one thread per core was allowed, instructed by usage of llvm::heavyweight_hardware_concurrency() in the ThinLTO code. Any number passed to the LLD flag /opt:lldltojobs=..., or any other ThinLTO-specific flag, was previously interpreted in the context of llvm::heavyweight_hardware_concurrency(), which means SMT disabled. One can now say in LLD: /opt:lldltojobs=0 -- Use one std::thread / hardware core in the system (no SMT). Default value if flag not specified. /opt:lldltojobs=N -- Limit usage to N threads, regardless of usage of heavyweight_hardware_concurrency(). /opt:lldltojobs=all -- Use all hardware threads in the system. Equivalent to /opt:lldltojobs=$(nproc) on Linux and /opt:lldltojobs=%NUMBER_OF_PROCESSORS% on Windows. When an affinity mask is set for the process, threads will be created only for the cores selected by the mask. When N > number-of-hardware-threads-in-the-system, the threads in the thread pool will be dispatched equally on all CPU sockets (tested only on Windows). When N <= number-of-hardware-threads-on-a-CPU-socket, the threads will remain on the CPU socket where the process started (only on Windows). Differential Revision: https://reviews.llvm.org/D75153
2020-02-14[Support] On Windows, ensure hardware_concurrency() extends to all CPU ↵Alexandre Ganea
sockets and all NUMA groups The goal of this patch is to maximize CPU utilization on multi-socket or high core count systems, so that parallel computations such as LLD/ThinLTO can use all hardware threads in the system. Before this patch, on Windows, a maximum of 64 hardware threads could be used at most, in some cases dispatched only on one CPU socket. == Background == Windows doesn't have a flat cpu_set_t like Linux. Instead, it projects hardware CPUs (or NUMA nodes) to applications through a concept of "processor groups". A "processor" is the smallest unit of execution on a CPU, that is, an hyper-thread if SMT is active; a core otherwise. There's a limit of 32-bit processors on older 32-bit versions of Windows, which later was raised to 64-processors with 64-bit versions of Windows. This limit comes from the affinity mask, which historically is represented by the sizeof(void*). Consequently, the concept of "processor groups" was introduced for dealing with systems with more than 64 hyper-threads. By default, the Windows OS assigns only one "processor group" to each starting application, in a round-robin manner. If the application wants to use more processors, it needs to programmatically enable it, by assigning threads to other "processor groups". This also means that affinity cannot cross "processor group" boundaries; one can only specify a "preferred" group on start-up, but the application is free to allocate more groups if it wants to. This creates a peculiar situation, where newer CPUs like the AMD EPYC 7702P (64-cores, 128-hyperthreads) are projected by the OS as two (2) "processor groups". This means that by default, an application can only use half of the cores. This situation could only get worse in the years to come, as dies with more cores will appear on the market. == The problem == The heavyweight_hardware_concurrency() API was introduced so that only *one hardware thread per core* was used. Once that API returns, that original intention is lost, only the number of threads is retained. Consider a situation, on Windows, where the system has 2 CPU sockets, 18 cores each, each core having 2 hyper-threads, for a total of 72 hyper-threads. Both heavyweight_hardware_concurrency() and hardware_concurrency() currently return 36, because on Windows they are simply wrappers over std::thread::hardware_concurrency() -- which can only return processors from the current "processor group". == The changes in this patch == To solve this situation, we capture (and retain) the initial intention until the point of usage, through a new ThreadPoolStrategy class. The number of threads to use is deferred as late as possible, until the moment where the std::threads are created (ThreadPool in the case of ThinLTO). When using hardware_concurrency(), setting ThreadCount to 0 now means to use all the possible hardware CPU (SMT) threads. Providing a ThreadCount above to the maximum number of threads will have no effect, the maximum will be used instead. The heavyweight_hardware_concurrency() is similar to hardware_concurrency(), except that only one thread per hardware *core* will be used. When LLVM_ENABLE_THREADS is OFF, the threading APIs will always return 1, to ensure any caller loops will be exercised at least once. Differential Revision: https://reviews.llvm.org/D71775
2019-10-23Reland "[Support] Add a way to run a function on a detached thread""Sam McCall
This reverts commit 7bc7fe6b789d25d48d6dc71d533a411e9e981237. The immediate callers have been fixed to pass nullopt where appropriate.
2019-10-23Revert "[Support] Add a way to run a function on a detached thread"Sam McCall
This reverts commit 40668abca4d307e02b33345cfdb7271549ff48d0. This causes clang tests to fail, as stacksize=0 is being explicitly passed and is no longer a no-op.
2019-10-23[Support] Add a way to run a function on a detached threadSam McCall
This roughly mimics `std::thread(...).detach()` except it allows to customize the stack size. Required for https://reviews.llvm.org/D50993. I've decided against reusing the existing `llvm_execute_on_thread` because it's not obvious what to do with the ownership of the passed function/arguments: 1. If we pass possibly owning functions data to `llvm_execute_on_thread`, we'll lose the ability to pass small non-owning non-allocating functions for the joining case (as it's used now). Is it important enough? 2. If we use the non-owning interface in the new use case, we'll force clients to transfer ownership to the spawned thread manually, but similar code would still have to exist inside `llvm_execute_on_thread(_async)` anyway (as we can't just pass the same non-owning pointer to pthreads and Windows implementations, and would be forced to wrap it in some structure, and deal with its ownership. Patch by Dmitry Kozhevnikov! Differential Revision: https://reviews.llvm.org/D51103
2019-01-19Update the file headers across all of the LLVM projects in the monorepoChandler Carruth
to reflect the new license. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351636
2018-04-29s/LLVM_ON_WIN32/_WIN32/, llvmNico Weber
LLVM_ON_WIN32 is set exactly with MSVC and MinGW (but not Cygwin) in HandleLLVMOptions.cmake, which is where _WIN32 defined too. Just use the default macro instead of a reinvented one. See thread "Replacing LLVM_ON_WIN32 with just _WIN32" on llvm-dev and cfe-dev. No intended behavior change. This moves over all uses of the macro, but doesn't remove the definition of it in (llvm-)config.h yet. llvm-svn: 331127
2017-10-04Bring r314809 back.Rafael Espindola
But now include a check for CPU_COUNT so we still build on 10 year old versions of glibc. Original message: Use sched_getaffinity instead of std::thread::hardware_concurrency. The issue with std::thread::hardware_concurrency is that it forwards to libc and some implementations (like glibc) don't take thread affinity into consideration. With this change a llvm program that can execute in only 2 cores will use 2 threads, even if the machine has 32 cores. This makes benchmarking a lot easier, but should also help if someone doesn't want to use all cores for compilation for example. llvm-svn: 314931
2017-10-04Revert D38481 due to missing cmake check for CPU_COUNTDaniel Neilson
Summary: This reverts D38481. The change breaks systems with older versions of glibc. It injects a use of CPU_COUNT() from sched.h without checking to ensure that the function exists first. Reviewers: Subscribers: llvm-svn: 314922
2017-10-03Use sched_getaffinity instead of std::thread::hardware_concurrency.Rafael Espindola
The issue with std::thread::hardware_concurrency is that it forwards to libc and some implementations (like glibc) don't take thread affinity into consideration. With this change a llvm program that can execute in only 2 cores will use 2 threads, even if the machine has 32 cores. This makes benchmarking a lot easier, but should also help if someone doesn't want to use all cores for compilation for example. llvm-svn: 314809
2017-03-04Try to fix thread name truncation on non-Windows.Zachary Turner
llvm-svn: 296976
2017-03-03Fix Threading path when LLVM_ENABLE_THREADS=0.Zachary Turner
llvm-svn: 296914
2017-03-03Don't bring in llvm/Support/thread.h in Threading.cppZachary Turner
Doing so defines the type llvm::thread. On FreeBSD, we need to call a macro which references its own ::thread type, which causes an ambiguity due to ADL when inside of the llvm namespace. Since we don't even need this unless LLVM_ENABLE_THREADS == 1, we don't even need this type anyway, as it is always equal to std::thread, so we can just use that directly. llvm-svn: 296891
2017-03-03[Support] Provide access to current thread name/thread id.Zachary Turner
Applications often need the current thread id when making system calls, and some operating systems provide the notion of a thread name, which can be useful in enabling better diagnostics when debugging or logging. This patch adds an accessor for the thread id, and "best effort" getters and setters for the thread name. Since this is non critical functionality, no error is returned to indicate that a platform doesn't support thread names. Differential Revision: https://reviews.llvm.org/D30526 llvm-svn: 296887
2016-10-17Rename interface for querying physical hardware concurrencyTeresa Johnson
Based on post-commit review for D25585/r284180, rename hardware_physical_concurrency to heavyweight_hardware_concurrency, to better reflect what type of tasks it should be used for and to enable other systems to map this to something other than the number of physical cores. llvm-svn: 284390
2016-10-14hardware_physical_concurrency() should return 1 when LLVM is built with ↵Mehdi Amini
LLVM_ENABLE_THREADS=OFF llvm-svn: 284283
2016-10-14Add interface for querying physical hardware concurrencyTeresa Johnson
Summary: This will be used by ThinLTO to set the amount of backend parallelism, which performs better when restricted to the number of physical cores (on X86 at least, where getHostNumPhysicalCores is currently defined). If not available this falls back to thread::hardware_concurrency. Note I didn't add to the thread class since that is a typedef to std::thread where available. Reviewers: mehdi_amini Subscribers: beanz, llvm-commits, mgorny Differential Revision: https://reviews.llvm.org/D25585 llvm-svn: 284180
2016-06-04[LPM] Reinstate r271781 which reinstated r271652 to replace theChandler Carruth
CALL_ONCE_... macro in the legacy pass manager with the new llvm::call_once facility. Nothing changed sicne the last attempt in r271781 which I reverted in r271788. At least one of the failures I saw was spurious, and I want to make sure the other failures are real before I work around them -- they appeared to only effect ppc64le and ppc64be. Original commit message of r271781: ---- [LPM] Reinstate r271652 to replace the CALL_ONCE_... macro in the legacy pass manager with the new llvm::call_once facility. This reverts commit r271657 and re-applies r271652 with a fix to actually work with arguments. In the original version, we just ended up directly calling std::call_once via ADL because of the std::once_flag argument. The llvm::call_once never worked with arguments. Now, llvm::call_once is a variadic template that perfectly forwards everything. As a part of this it had to move to the header and we use a generic functor rather than an explict function pointer. It would be nice to use std::invoke here but we don't have it yet. That means pointer to members won't work here, but that seems a tolerable compromise. I've also tested this by forcing the fallback path, so hopefully it sticks this time. ---- Original commit message of r271652: ---- [LPM] Replace the CALL_ONCE_... macro in the legacy pass manager with the new llvm::call_once facility. This facility matches the standard APIs and when the platform supports it actually directly uses the standard provided functionality. This is both more efficient on some platforms and much more TSan friendly. The only remaining user of the cas_flag and home-rolled atomics is the fallback implementation of call_once. I have a patch that removes them entirely, but it needs a Windows patch to land first. This alone substantially cleans up the macros for the legacy pass manager, and should subsume some of the work Mehdi was doing to clear the path for TSan testing of ThinLTO, a really important step to have reliable upstream testing of ThinLTO in all forms. ---- llvm-svn: 271800
2016-06-04[LPM] Revert r271781 which was a re-commit of r271652.Chandler Carruth
There appears to be a strange exception thrown and crash using call_once on a PPC build bot, and a *really* weird windows link error for GCMetadata.obj. Still need to investigate the cause of both problems. Original change summary: [LPM] Reinstate r271652 to replace the CALL_ONCE_... macro in the legacy pass manager with the new llvm::call_once facility. llvm-svn: 271788
2016-06-04[LPM] Reinstate r271652 to replace the CALL_ONCE_... macro in the legacyChandler Carruth
pass manager with the new llvm::call_once facility. This reverts commit r271657 and re-applies r271652 with a fix to actually work with arguments. In the original version, we just ended up directly calling std::call_once via ADL because of the std::once_flag argument. The llvm::call_once never worked with arguments. Now, llvm::call_once is a variadic template that perfectly forwards everything. As a part of this it had to move to the header and we use a generic functor rather than an explict function pointer. It would be nice to use std::invoke here but we don't have it yet. That means pointer to members won't work here, but that seems a tolerable compromise. I've also tested this by forcing the fallback path, so hopefully it sticks this time. Original commit message: ---- [LPM] Replace the CALL_ONCE_... macro in the legacy pass manager with the new llvm::call_once facility. This facility matches the standard APIs and when the platform supports it actually directly uses the standard provided functionality. This is both more efficient on some platforms and much more TSan friendly. The only remaining user of the cas_flag and home-rolled atomics is the fallback implementation of call_once. I have a patch that removes them entirely, but it needs a Windows patch to land first. This alone substantially cleans up the macros for the legacy pass manager, and should subsume some of the work Mehdi was doing to clear the path for TSan testing of ThinLTO, a really important step to have reliable upstream testing of ThinLTO in all forms. llvm-svn: 271781
2016-06-02Fix the use of sys::MemoryFence after including WindowsSupport.h thatChandler Carruth
r271558 introduced. llvm-svn: 271563
2016-06-02This is yet another attempt to re-instate r220932 as discussed inChandler Carruth
D19271. Previous attempt was broken by NetBSD, so in this version I've made the fallback path generic rather than Windows specific and sent both Windows and NetBSD to it. I've also re-formatted the code some, and used an exact clone of the code in PassSupport.h for doing manual call-once using our atomics rather than rolling a new one. If this sticks, we can replace the fallback path for Windows with a Windows-specific implementation that is more reliable. Original commit message: This patch adds an llvm_call_once which is a wrapper around std::call_once on platforms where it is available and devoid of bugs. The patch also migrates the ManagedStatic mutex to be allocated using llvm_call_once. These changes are philosophically equivalent to the changes added in r219638, which were reverted due to a hang on Win32 which was the result of a bug in the Windows implementation of std::call_once. Differential Revision: http://reviews.llvm.org/D5922 llvm-svn: 271558
2016-05-14Revert "Revert "Revert 220932.": "Removing the static initializer in ↵Mehdi Amini
ManagedStatic.cpp by using llvm_call_once to initialize the ManagedStatic mutex"" This reverts commit r269577. Broke NetBSD, waiting for Kamil to investigate From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 269584
2016-05-14Revert "Revert 220932.": "Removing the static initializer in ↵Mehdi Amini
ManagedStatic.cpp by using llvm_call_once to initialize the ManagedStatic mutex" This reverts commit r221331 and reinstate r220932 as discussed in D19271. Original commit message was: This patch adds an llvm_call_once which is a wrapper around std::call_once on platforms where it is available and devoid of bugs. The patch also migrates the ManagedStatic mutex to be allocated using llvm_call_once. These changes are philosophically equivalent to the changes added in r219638, which were reverted due to a hang on Win32 which was the result of a bug in the Windows implementation of std::call_once. Differential Revision: http://reviews.llvm.org/D5922 From: Mehdi Amini <mehdi.amini@apple.com> llvm-svn: 269577
2014-11-05Revert 220932.Jiangning Liu
Commit 220932 caused crash when building clang-tblgen on aarch64 debian target, so it's blocking all daily tests. The std::call_once implementation in pthread has bug for aarch64 debian. llvm-svn: 221331
2014-10-30Removing the static initializer in ManagedStatic.cpp by using llvm_call_once ↵Chris Bieneman
to initialize the ManagedStatic mutex. Summary: This patch adds an llvm_call_once which is a wrapper around std::call_once on platforms where it is available and devoid of bugs. The patch also migrates the ManagedStatic mutex to be allocated using llvm_call_once. These changes are philosophically equivalent to the changes added in r219638, which were reverted due to a hang on Win32 which was the result of a bug in the Windows implementation of std::call_once. Reviewers: aaron.ballman, chapuni, chandlerc, rnk Reviewed By: rnk Subscribers: majnemer, llvm-commits Differential Revision: http://reviews.llvm.org/D5922 llvm-svn: 220932