[llvm] e23dce6 - [Support] Get correct number of physical cores on Apple Silicon

Steven Wu via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 14 13:30:05 PDT 2021


Author: Steven Wu
Date: 2021-07-14T13:29:54-07:00
New Revision: e23dce6c974477d3476bee5256a83a9aaea8eae4

URL: https://github.com/llvm/llvm-project/commit/e23dce6c974477d3476bee5256a83a9aaea8eae4
DIFF: https://github.com/llvm/llvm-project/commit/e23dce6c974477d3476bee5256a83a9aaea8eae4.diff

LOG: [Support] Get correct number of physical cores on Apple Silicon

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

Added: 
    

Modified: 
    llvm/lib/Support/Host.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Support/Host.cpp b/llvm/lib/Support/Host.cpp
index 478351769705c..1ecfef95fdffb 100644
--- a/llvm/lib/Support/Host.cpp
+++ b/llvm/lib/Support/Host.cpp
@@ -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>
 


        


More information about the llvm-commits mailing list