[lld] r285968 - Always use parallel_for_each because it falls back to std::for_each.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 3 14:28:21 PDT 2016


Author: ruiu
Date: Thu Nov  3 16:28:19 2016
New Revision: 285968

URL: http://llvm.org/viewvc/llvm-project?rev=285968&view=rev
Log:
Always use parallel_for_each because it falls back to std::for_each.

If multi-threading is disabled, parallel_for_each will automatically
fall back to std::for_each, so we don't have to do that ourselves.

Modified:
    lld/trunk/ELF/OutputSections.cpp

Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=285968&r1=285967&r2=285968&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Thu Nov  3 16:28:19 2016
@@ -1064,13 +1064,8 @@ template <class ELFT> void OutputSection
   ArrayRef<uint8_t> Filler = Script<ELFT>::X->getFiller(this->Name);
   if (!Filler.empty())
     fill(Buf, this->getSize(), Filler);
-  if (Config->Threads) {
-    parallel_for_each(Sections.begin(), Sections.end(),
-                      [=](InputSection<ELFT> *C) { C->writeTo(Buf); });
-  } else {
-    for (InputSection<ELFT> *C : Sections)
-      C->writeTo(Buf);
-  }
+  parallel_for_each(Sections.begin(), Sections.end(),
+                    [=](InputSection<ELFT> *C) { C->writeTo(Buf); });
   // Linker scripts may have BYTE()-family commands with which you
   // can write arbitrary bytes to the output. Process them if any.
   Script<ELFT>::X->writeDataBytes(this->Name, Buf);




More information about the llvm-commits mailing list