[all-commits] [llvm/llvm-project] 3c97f6: [Support] Move getHostNumPhysicalCores to Threading.h

Sam Elliott via All-commits all-commits at lists.llvm.org
Tue Nov 29 05:14:33 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3c97f6cab92fb3511d72996ac7ca8a8b459ebc88
      https://github.com/llvm/llvm-project/commit/3c97f6cab92fb3511d72996ac7ca8a8b459ebc88
  Author: Archibald Elliott <archibald.elliott at arm.com>
  Date:   2022-11-29 (Tue, 29 Nov 2022)

  Changed paths:
    M clang-tools-extra/clangd/test/Inputs/BenchmarkHeader.h
    M llvm/include/llvm/Support/Host.h
    M llvm/include/llvm/Support/Threading.h
    M llvm/lib/Support/Host.cpp
    M llvm/lib/Support/Threading.cpp
    M llvm/lib/Support/Unix/Threading.inc
    M llvm/lib/Support/Windows/Threading.inc
    M llvm/unittests/Support/Host.cpp
    M llvm/unittests/Support/Threading.cpp

  Log Message:
  -----------
  [Support] Move getHostNumPhysicalCores to Threading.h

This change is focussed on simplifying `Support/Host.h` to only do
target detection. In this case, this function is close in usage to
existing functions in `Support/Threading.h`, so I moved it into there.
The function is also renamed to `llvm::get_physical_cores()` to match
the style of threading's functions.

The big change here is that now if you have threading disabled,
`llvm::get_physical_cores()` will return -1, as if it had not been able
to work out the right info. This is due to how Threading.cpp includes
OS-specific code/headers. This seems ok, as if threading is disabled,
LLVM should not need to know the number of physical cores.

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




More information about the All-commits mailing list