Index: COFF/ICF.cpp =================================================================== --- COFF/ICF.cpp +++ COFF/ICF.cpp @@ -22,6 +22,7 @@ #include "Chunks.h" #include "Symbols.h" #include "lld/Common/ErrorHandler.h" +#include "lld/Common/Threads.h" #include "lld/Common/Timer.h" #include "llvm/ADT/Hashing.h" #include "llvm/Support/Debug.h" @@ -226,10 +227,10 @@ size_t Boundaries[NumShards + 1]; Boundaries[0] = 0; Boundaries[NumShards] = Chunks.size(); - for_each_n(parallel::par, size_t(1), NumShards, [&](size_t I) { + parallelForEachN(1, NumShards, [&](size_t I) { Boundaries[I] = findBoundary((I - 1) * Step, Chunks.size()); }); - for_each_n(parallel::par, size_t(1), NumShards + 1, [&](size_t I) { + parallelForEachN(1, NumShards + 1, [&](size_t I) { if (Boundaries[I - 1] < Boundaries[I]) { forEachClassRange(Boundaries[I - 1], Boundaries[I], Fn); } @@ -261,13 +262,13 @@ SC->Class[0] = NextId++; // Initially, we use hash values to partition sections. - for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) { + parallelForEach(Chunks, [&](SectionChunk *SC) { SC->Class[1] = xxHash64(SC->getContents()); }); // Combine the hashes of the sections referenced by each section into its // hash. - for_each(parallel::par, Chunks.begin(), Chunks.end(), [&](SectionChunk *SC) { + parallelForEach(Chunks, [&](SectionChunk *SC) { uint32_t Hash = SC->Class[1]; for (Symbol *B : SC->symbols()) if (auto *Sym = dyn_cast_or_null(B))