[llvm] 4c7f500 - llvm-reduce: Use ThreadPool feature to wait for tasks to complete
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 27 16:15:06 PST 2023
Author: Matt Arsenault
Date: 2023-01-27T20:14:36-04:00
New Revision: 4c7f500bd202dc8ed0a4229022571305b6edf734
URL: https://github.com/llvm/llvm-project/commit/4c7f500bd202dc8ed0a4229022571305b6edf734
DIFF: https://github.com/llvm/llvm-project/commit/4c7f500bd202dc8ed0a4229022571305b6edf734.diff
LOG: llvm-reduce: Use ThreadPool feature to wait for tasks to complete
Don't use the hackier barrier I wrote using the task queue.
Added:
Modified:
llvm/tools/llvm-reduce/deltas/Delta.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-reduce/deltas/Delta.cpp b/llvm/tools/llvm-reduce/deltas/Delta.cpp
index 9bdfb665f52d..386fc64ce08e 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -169,14 +169,6 @@ static SmallString<0> ProcessChunkFromSerializedBitcode(
using SharedTaskQueue = std::deque<std::shared_future<SmallString<0>>>;
-static void waitAndDiscardResultsBarrier(SharedTaskQueue &TaskQueue) {
- while (!TaskQueue.empty()) {
- auto &Future = TaskQueue.front();
- Future.wait();
- TaskQueue.pop_front();
- }
-}
-
/// Runs the Delta Debugging algorithm, splits the code into chunks and
/// reduces the amount of chunks that are considered interesting by the
/// given test. The number of chunks is determined by a preliminary run of the
@@ -261,7 +253,7 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
unsigned NumChunksProcessed = 0;
ThreadPool &ChunkThreadPool = *ChunkThreadPoolPtr;
- TaskQueue.clear();
+ assert(TaskQueue.empty());
AnyReduced = false;
// Queue jobs to process NumInitialTasks chunks in parallel using
@@ -317,7 +309,8 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
//
// TODO: Create a way to kill remaining items we're ignoring; they could
// take a long time.
- waitAndDiscardResultsBarrier(TaskQueue);
+ ChunkThreadPoolPtr->wait();
+ TaskQueue.clear();
// Forward I to the last chunk processed in parallel.
I += NumChunksProcessed - 1;
More information about the llvm-commits
mailing list