summaryrefslogtreecommitdiffstats
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorDaniel Neilson <dneilson@azul.com>2017-10-04 18:19:03 +0000
committerDaniel Neilson <dneilson@azul.com>2017-10-04 18:19:03 +0000
commitbef94bcbae5f5f4e01f0247322e3381f0cc07c5e (patch)
tree2966d82cacfaddcd03fc96d4d9db4d08d09fb8ba /llvm/tools/llvm-profdata/llvm-profdata.cpp
parent9edbe110e88a99215836cfc4700f4fab6c8f4dbe (diff)
downloadbcm5719-llvm-bef94bcbae5f5f4e01f0247322e3381f0cc07c5e.tar.gz
bcm5719-llvm-bef94bcbae5f5f4e01f0247322e3381f0cc07c5e.zip
Revert D38481 due to missing cmake check for CPU_COUNT
Summary: This reverts D38481. The change breaks systems with older versions of glibc. It injects a use of CPU_COUNT() from sched.h without checking to ensure that the function exists first. Reviewers: Subscribers: llvm-svn: 314922
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 8e21a7a9b4f..eee242107da 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -211,8 +211,8 @@ static void mergeInstrProfile(const WeightedFileVector &Inputs,
// If NumThreads is not specified, auto-detect a good default.
if (NumThreads == 0)
- NumThreads =
- std::min(hardware_concurrency(), unsigned((Inputs.size() + 1) / 2));
+ NumThreads = std::max(1U, std::min(std::thread::hardware_concurrency(),
+ unsigned(Inputs.size() / 2)));
// Initialize the writer contexts.
SmallVector<std::unique_ptr<WriterContext>, 4> Contexts;
OpenPOWER on IntegriCloud