[llvm] f0131c3 - llvm-reduce: Avoid reallocating per chunk iteration (#135029)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 09:57:56 PDT 2025


Author: Matt Arsenault
Date: 2025-04-09T18:57:53+02:00
New Revision: f0131c327ea1432ff45f385aac28fe5d57005244

URL: https://github.com/llvm/llvm-project/commit/f0131c327ea1432ff45f385aac28fe5d57005244
DIFF: https://github.com/llvm/llvm-project/commit/f0131c327ea1432ff45f385aac28fe5d57005244.diff

LOG: llvm-reduce: Avoid reallocating per chunk iteration (#135029)

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 6bf1b99346b13..39d61cd63d4cd 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -246,16 +246,20 @@ void llvm::runDeltaPass(TestRunner &Test, const DeltaPass &Pass) {
     ChunkThreadPoolPtr =
         std::make_unique<DefaultThreadPool>(hardware_concurrency(NumJobs));
 
+  SmallString<0> OriginalBC;
+  DenseSet<Chunk> UninterestingChunks;
+  UninterestingChunks.reserve(Targets);
+
   bool FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity;
   do {
     FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity = false;
 
-    DenseSet<Chunk> UninterestingChunks;
+    UninterestingChunks.clear();
 
     // When running with more than one thread, serialize the original bitcode
     // to OriginalBC.
-    SmallString<0> OriginalBC;
     if (NumJobs > 1) {
+      OriginalBC.clear();
       raw_svector_ostream BCOS(OriginalBC);
       Test.getProgram().writeBitcode(BCOS);
     }


        


More information about the llvm-commits mailing list