Index: include/lld/Core/Parallel.h =================================================================== --- include/lld/Core/Parallel.h +++ include/lld/Core/Parallel.h @@ -295,7 +295,15 @@ #else template void parallel_for_each(Iterator begin, Iterator end, Func func) { - // TODO: Make this parallel. + TaskGroup tg; + const ptrdiff_t minParallelSizeForEach = 1024; + int64_t length = std::distance(begin, end); + int64_t taskSize = + (length < minParallelSizeForEach) ? length : minParallelSizeForEach; + while (taskSize <= std::distance(begin, end)) { + tg.spawn([=, &func, &tg] { std::for_each(begin, begin + taskSize, func); }); + begin += taskSize; + } std::for_each(begin, end, func); } #endif