[llvm] r284283 - hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_THREADS=OFF
Mehdi Amini via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 14 14:32:35 PDT 2016
Author: mehdi_amini
Date: Fri Oct 14 16:32:35 2016
New Revision: 284283
URL: http://llvm.org/viewvc/llvm-project?rev=284283&view=rev
Log:
hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_THREADS=OFF
Modified:
llvm/trunk/include/llvm/Support/Threading.h
llvm/trunk/lib/Support/Threading.cpp
Modified: llvm/trunk/include/llvm/Support/Threading.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Threading.h?rev=284283&r1=284282&r2=284283&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Threading.h (original)
+++ llvm/trunk/include/llvm/Support/Threading.h Fri Oct 14 16:32:35 2016
@@ -118,6 +118,7 @@ namespace llvm {
/// Get the amount of currency based on physical cores, if available for the
/// host system, otherwise falls back to thread::hardware_concurrency().
+ /// Returns 1 when LLVM is configured with LLVM_ENABLE_THREADS=OFF
unsigned hardware_physical_concurrency();
}
Modified: llvm/trunk/lib/Support/Threading.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Threading.cpp?rev=284283&r1=284282&r2=284283&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Threading.cpp (original)
+++ llvm/trunk/lib/Support/Threading.cpp Fri Oct 14 16:32:35 2016
@@ -119,6 +119,9 @@ void llvm::llvm_execute_on_thread(void (
#endif
unsigned llvm::hardware_physical_concurrency() {
+#if !LLVM_ENABLE_THREADS
+ return 1;
+#endif
int NumPhysical = sys::getHostNumPhysicalCores();
if (NumPhysical == -1)
return thread::hardware_concurrency();
More information about the llvm-commits
mailing list