diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake index 612ce5bdbcbea..d9624c42da666 100644 --- a/llvm/cmake/config-ix.cmake +++ b/llvm/cmake/config-ix.cmake @@ -274,8 +274,6 @@ if( LLVM_USING_GLIBC ) list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") endif() # This check requires _GNU_SOURCE -check_symbol_exists(sched_getaffinity sched.h HAVE_SCHED_GETAFFINITY) -check_symbol_exists(CPU_COUNT sched.h HAVE_CPU_COUNT) if (NOT PURE_WINDOWS) if (LLVM_PTHREAD_LIB) list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB}) diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake index 1a38bc15ab9d6..290f74bd02d26 100644 --- a/llvm/include/llvm/Config/config.h.cmake +++ b/llvm/include/llvm/Config/config.h.cmake @@ -160,12 +160,6 @@ /* Define to 1 if you have the `setenv' function. */ #cmakedefine HAVE_SETENV ${HAVE_SETENV} -/* Define to 1 if you have the `sched_getaffinity' function. */ -#cmakedefine HAVE_SCHED_GETAFFINITY ${HAVE_SCHED_GETAFFINITY} - -/* Define to 1 if you have the `CPU_COUNT' macro. */ -#cmakedefine HAVE_CPU_COUNT ${HAVE_CPU_COUNT} - /* Define to 1 if you have the `setrlimit' function. */ #cmakedefine HAVE_SETRLIMIT ${HAVE_SETRLIMIT} diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc index 307a244691447..5c1bfc5620c64 100644 --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -38,6 +38,7 @@ #endif #if defined(__linux__) +#include // For sched_getaffinity #include // For syscall codes #include // For syscall() #endif @@ -271,7 +272,7 @@ SetThreadPriorityResult llvm::set_thread_priority(ThreadPriority Priority) { #include int computeHostNumHardwareThreads() { -#if defined(HAVE_SCHED_GETAFFINITY) && defined(HAVE_CPU_COUNT) +#ifdef __linux__ cpu_set_t Set; if (sched_getaffinity(0, sizeof(Set), &Set) == 0) return CPU_COUNT(&Set); diff --git a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn index f8e1026475f5d..9f29caddd79e3 100644 --- a/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn +++ b/llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn @@ -141,8 +141,6 @@ write_cmake_config("config") { "HAVE_LSEEK64=1", "HAVE_MALLINFO=1", "HAVE_POSIX_FALLOCATE=1", - "HAVE_SCHED_GETAFFINITY=1", - "HAVE_CPU_COUNT=1", "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=1", ] } else { @@ -152,8 +150,6 @@ write_cmake_config("config") { "HAVE_LSEEK64=", "HAVE_MALLINFO=", "HAVE_POSIX_FALLOCATE=", - "HAVE_SCHED_GETAFFINITY=", - "HAVE_CPU_COUNT=", "HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC=", ] }