[LLD][ELF] Put back rounding which was lost in 8404aeb56a73ab24f9b295111de3b37a37f0b841
authorAlexandre Ganea <alexandre.ganea@ubisoft.com>
Mon, 30 Mar 2020 01:51:45 +0000 (21:51 -0400)
committerAlexandre Ganea <alexandre.ganea@ubisoft.com>
Mon, 30 Mar 2020 01:52:01 +0000 (21:52 -0400)
lld/ELF/SyntheticSections.cpp

index ed2cdb7..2388b08 100644 (file)
@@ -2750,7 +2750,8 @@ createSymbols(ArrayRef<std::vector<GdbIndexSection::NameAttrEntry>> nameAttrs,
   size_t concurrency = 1;
   if (threadsEnabled)
     concurrency = std::min<size_t>(
-        hardware_concurrency().compute_thread_count(), numShards);
+        PowerOf2Floor(hardware_concurrency().compute_thread_count()),
+        numShards);
 
   // A sharded map to uniquify symbols by name.
   std::vector<DenseMap<CachedHashStringRef, size_t>> map(numShards);
@@ -3196,7 +3197,8 @@ void MergeNoTailSection::finalizeContents() {
   size_t concurrency = 1;
   if (threadsEnabled)
     concurrency = std::min<size_t>(
-        hardware_concurrency().compute_thread_count(), numShards);
+        PowerOf2Floor(hardware_concurrency().compute_thread_count()),
+        numShards);
 
   // Add section pieces to the builders.
   parallelForEachN(0, concurrency, [&](size_t threadId) {