Skip to content

Commit f0131c3

Browse files
authored
llvm-reduce: Avoid reallocating per chunk iteration (#135029)
1 parent c048073 commit f0131c3

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

llvm/tools/llvm-reduce/deltas/Delta.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,20 @@ void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
246246
ChunkThreadPoolPtr =
247247
std::make_unique<DefaultThreadPool>(hardware_concurrency(NumJobs));
248248

249+
SmallString<0> OriginalBC;
250+
DenseSet<Chunk> UninterestingChunks;
251+
UninterestingChunks.reserve(Targets);
252+
249253
bool FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity;
250254
do {
251255
FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity = false;
252256

253-
DenseSet<Chunk> UninterestingChunks;
257+
UninterestingChunks.clear();
254258

255259
// When running with more than one thread, serialize the original bitcode
256260
// to OriginalBC.
257-
SmallString<0> OriginalBC;
258261
if (NumJobs > 1) {
262+
OriginalBC.clear();
259263
raw_svector_ostream BCOS(OriginalBC);
260264
Test.getProgram().writeBitcode(BCOS);
261265
}

0 commit comments

Comments
 (0)