[PATCH] D84764: Fix computeHostNumPhysicalCores() for Linux on POWER and Linux on Z

Ettore Tiotto via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 07:07:38 PDT 2020


etiotto updated this revision to Diff 281566.
etiotto added a comment.

Fix formatting


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84764

Files:
  llvm/lib/Support/Host.cpp


Index: llvm/lib/Support/Host.cpp
===================================================================
--- llvm/lib/Support/Host.cpp
+++ llvm/lib/Support/Host.cpp
@@ -1271,6 +1271,12 @@
   }
   return CPU_COUNT(&Enabled);
 }
+#elif (defined(__linux__) &&                                                   \
+       (defined(__ppc__) || defined(__powerpc__) || defined(__s390x__)))
+#include <unistd.h>
+
+// Gets the number of *physical cores* on the machine.
+int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
 #elif defined(__APPLE__) && defined(__x86_64__)
 #include <sys/param.h>
 #include <sys/sysctl.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84764.281566.patch
Type: text/x-patch
Size: 633 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200729/d206266b/attachment.bin>


More information about the llvm-commits mailing list