aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Threading.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/Threading.cpp')
-rw-r--r--llvm/lib/Support/Threading.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp
index e8f5622..415c63f 100644
--- a/llvm/lib/Support/Threading.cpp
+++ b/llvm/lib/Support/Threading.cpp
@@ -15,6 +15,7 @@
#include "llvm/Support/Threading.h"
#include "llvm/Config/config.h"
#include "llvm/Support/Atomic.h"
+#include "llvm/Support/Host.h"
#include "llvm/Support/Mutex.h"
#include "llvm/Support/thread.h"
#include <cassert>
@@ -116,3 +117,10 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData,
}
#endif
+
+unsigned llvm::hardware_physical_concurrency() {
+ int NumPhysical = sys::getHostNumPhysicalCores();
+ if (NumPhysical == -1)
+ return thread::hardware_concurrency();
+ return NumPhysical;
+}