[PATCH] D142317: [Support] Avoid using main thread for llvm::parallelFor().
Alexey Lapshin via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 24 05:26:55 PST 2023
avl updated this revision to Diff 491727.
avl edited the summary of this revision.
avl added a comment.
addressed comments.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D142317/new/
https://reviews.llvm.org/D142317
Files:
llvm/lib/Support/Parallel.cpp
Index: llvm/lib/Support/Parallel.cpp
===================================================================
--- llvm/lib/Support/Parallel.cpp
+++ llvm/lib/Support/Parallel.cpp
@@ -214,8 +214,12 @@
Fn(I);
});
}
- for (; Begin != End; ++Begin)
- Fn(Begin);
+ if (Begin != End) {
+ TG.spawn([=, &Fn] {
+ for (size_t I = Begin; I != End; ++I)
+ Fn(I);
+ });
+ }
return;
}
#endif
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D142317.491727.patch
Type: text/x-patch
Size: 444 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230124/89c1b1d9/attachment.bin>
More information about the llvm-commits
mailing list