[Support] Get correct number of physical cores on Apple Silicon
authorSteven Wu <stevenwu@apple.com>
Wed, 14 Jul 2021 20:29:15 +0000 (13:29 -0700)
committerSteven Wu <stevenwu@apple.com>
Wed, 14 Jul 2021 20:29:54 +0000 (13:29 -0700)
Fix a bug that `computeHostNumPhysicalCores` is fallback to default
unknown when building for Apple Silicon macs.

rdar://80533675

Reviewed By: arphaman

Differential Revision: https://reviews.llvm.org/D106012

llvm/lib/Support/Host.cpp

index 4783517..1ecfef9 100644 (file)
@@ -1404,7 +1404,7 @@ int computeHostNumPhysicalCores() {
 }
 #elif defined(__linux__) && defined(__s390x__)
 int computeHostNumPhysicalCores() { return sysconf(_SC_NPROCESSORS_ONLN); }
-#elif defined(__APPLE__) && defined(__x86_64__)
+#elif defined(__APPLE__)
 #include <sys/param.h>
 #include <sys/sysctl.h>