[lld] r287948 - We shouldn't call parallle_for_each if -no-thread is given.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 25 12:20:58 PST 2016
Author: ruiu
Date: Fri Nov 25 14:20:57 2016
New Revision: 287948
URL: http://llvm.org/viewvc/llvm-project?rev=287948&view=rev
Log:
We shouldn't call parallle_for_each if -no-thread is given.
Modified:
lld/trunk/ELF/Driver.cpp
Modified: lld/trunk/ELF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Driver.cpp?rev=287948&r1=287947&r2=287948&view=diff
==============================================================================
--- lld/trunk/ELF/Driver.cpp (original)
+++ lld/trunk/ELF/Driver.cpp Fri Nov 25 14:20:57 2016
@@ -801,15 +801,18 @@ template <class ELFT> void LinkerDriver:
// MergeInputSection::splitIntoPieces needs to be called before
// any call of MergeInputSection::getOffset. Do that.
- parallel_for_each(Symtab.Sections.begin(), Symtab.Sections.end(),
- [](InputSectionBase<ELFT> *S) {
- if (!S->Live)
- return;
- if (S->Compressed)
- S->uncompress();
- if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S))
- MS->splitIntoPieces();
- });
+ auto Fn = [](InputSectionBase<ELFT> *S) {
+ if (!S->Live)
+ return;
+ if (S->Compressed)
+ S->uncompress();
+ if (auto *MS = dyn_cast<MergeInputSection<ELFT>>(S))
+ MS->splitIntoPieces();
+ };
+ if (Config->Threads)
+ parallel_for_each(Symtab.Sections.begin(), Symtab.Sections.end(), Fn);
+ else
+ std::for_each(Symtab.Sections.begin(), Symtab.Sections.end(), Fn);
// Write the result to the file.
writeResult<ELFT>();
More information about the llvm-commits
mailing list