aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-cov/CoverageReport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-cov/CoverageReport.cpp')
-rw-r--r--llvm/tools/llvm-cov/CoverageReport.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/llvm/tools/llvm-cov/CoverageReport.cpp b/llvm/tools/llvm-cov/CoverageReport.cpp
index 82259542c597..8509710032d1 100644
--- a/llvm/tools/llvm-cov/CoverageReport.cpp
+++ b/llvm/tools/llvm-cov/CoverageReport.cpp
@@ -352,15 +352,15 @@ std::vector<FileCoverageSummary> CoverageReport::prepareFileReports(
ArrayRef<std::string> Files, const CoverageViewOptions &Options,
const CoverageFilter &Filters) {
unsigned LCP = getRedundantPrefixLen(Files);
- auto NumThreads = Options.NumThreads;
- // If NumThreads is not specified, auto-detect a good default.
- if (NumThreads == 0)
- NumThreads =
- std::max(1U, std::min(llvm::heavyweight_hardware_concurrency(),
- unsigned(Files.size())));
-
- ThreadPool Pool(NumThreads);
+ ThreadPoolStrategy S = hardware_concurrency(Options.NumThreads);
+ if (Options.NumThreads == 0) {
+ // If NumThreads is not specified, create one thread for each input, up to
+ // the number of hardware cores.
+ S = heavyweight_hardware_concurrency(Files.size());
+ S.Limit = true;
+ }
+ ThreadPool Pool(S);
std::vector<FileCoverageSummary> FileReports;
FileReports.reserve(Files.size());