[PATCH] D74654: Don't call computeHostNumPhysicalCores when LLVM_ENABLE_THREADS is off

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 14 16:03:31 PST 2020


akhuang updated this revision to Diff 244789.
akhuang added a comment.

Fix test and macro spelling


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74654/new/

https://reviews.llvm.org/D74654

Files:
  llvm/lib/Support/Host.cpp
  llvm/unittests/Support/Host.cpp


Index: llvm/unittests/Support/Host.cpp
===================================================================
--- llvm/unittests/Support/Host.cpp
+++ llvm/unittests/Support/Host.cpp
@@ -13,6 +13,7 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
 #include "llvm/Support/Program.h"
+#include "llvm/Support/Threading.h"
 
 #include "gtest/gtest.h"
 
@@ -37,7 +38,7 @@
     // Initially this is only testing detection of the number of
     // physical cores, which is currently only supported/tested for
     // x86_64 Linux and Darwin.
-    return Host.isOSWindows() ||
+    return (Host.isOSWindows() && llvm_is_multithreaded()) ||
            (Host.getArch() == Triple::x86_64 &&
             (Host.isOSDarwin() || Host.getOS() == Triple::Linux));
   }
Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1326,7 +1326,7 @@
   }
   return count;
 }
-#elif defined(_WIN32) && LLVM_THREADS_ENABLED
+#elif defined(_WIN32) && LLVM_ENABLE_THREADS != 0
 // Defined in llvm/lib/Support/Windows/Threading.inc
 int computeHostNumPhysicalCores();
 #else


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74654.244789.patch
Type: text/x-patch
Size: 1177 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200215/139693d8/attachment.bin>


More information about the llvm-commits mailing list