From: Mehdi Amini Date: Fri, 14 Oct 2016 21:32:35 +0000 (+0000) Subject: hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_T... X-Git-Tag: llvmorg-4.0.0-rc1~7116 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f8fd20402acc0a8348a2ca1e5a399731ff723211;p=platform%2Fupstream%2Fllvm.git hardware_physical_concurrency() should return 1 when LLVM is built with LLVM_ENABLE_THREADS=OFF llvm-svn: 284283 --- diff --git a/llvm/include/llvm/Support/Threading.h b/llvm/include/llvm/Support/Threading.h index 7e4a289..8c9c0da 100644 --- a/llvm/include/llvm/Support/Threading.h +++ b/llvm/include/llvm/Support/Threading.h @@ -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(); } diff --git a/llvm/lib/Support/Threading.cpp b/llvm/lib/Support/Threading.cpp index 415c63f..fd303af 100644 --- a/llvm/lib/Support/Threading.cpp +++ b/llvm/lib/Support/Threading.cpp @@ -119,6 +119,9 @@ void llvm::llvm_execute_on_thread(void (*Fn)(void*), void *UserData, #endif unsigned llvm::hardware_physical_concurrency() { +#if !LLVM_ENABLE_THREADS + return 1; +#endif int NumPhysical = sys::getHostNumPhysicalCores(); if (NumPhysical == -1) return thread::hardware_concurrency();