diff --git a/llvm/lib/Support/Unix/Threading.inc b/llvm/lib/Support/Unix/Threading.inc --- a/llvm/lib/Support/Unix/Threading.inc +++ b/llvm/lib/Support/Unix/Threading.inc @@ -26,12 +26,9 @@ #include // For pthread_getthreadid_np() / pthread_set_name_np() #endif -#if defined(__FreeBSD__) -#include -#endif - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include +#include #include #include #include @@ -286,14 +283,13 @@ #include int computeHostNumHardwareThreads() { -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) cpuset_t mask; CPU_ZERO(&mask); if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask), &mask) == 0) return CPU_COUNT(&mask); -#endif -#ifdef __linux__ +#elif defined(__linux__) cpu_set_t Set; if (sched_getaffinity(0, sizeof(Set), &Set) == 0) return CPU_COUNT(&Set);