Index: include/llvm/Support/Parallel.h =================================================================== --- include/llvm/Support/Parallel.h +++ include/llvm/Support/Parallel.h @@ -158,11 +158,11 @@ TaskSize = 1; TaskGroup TG; - while (TaskSize <= std::distance(Begin, End)) { + while (TaskSize < std::distance(Begin, End)) { TG.spawn([=, &Fn] { std::for_each(Begin, Begin + TaskSize, Fn); }); Begin += TaskSize; } - TG.spawn([=, &Fn] { std::for_each(Begin, End, Fn); }); + std::for_each(Begin, End, Fn); } template @@ -179,10 +179,8 @@ Fn(J); }); } - TG.spawn([=, &Fn] { - for (IndexTy J = I; J < End; ++J) - Fn(J); - }); + for (IndexTy J = I; J < End; ++J) + Fn(J); } #endif