[llvm] 7d2b7be - [llvm-reduce] Only write reduced output after we've saved it

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Mon May 15 15:49:49 PDT 2023


Author: Arthur Eubanks
Date: 2023-05-15T15:49:22-07:00
New Revision: 7d2b7be28d903a74f3ca10b2d5f97d69e006df62

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

LOG: [llvm-reduce] Only write reduced output after we've saved it

Otherwise we're just rewriting the currently saved module instead of the newly reduced one.

Doesn't affect the final output since we separately write that at the end.

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 386fc64ce08e8..46bc93c1ce33f 100644
--- a/llvm/tools/llvm-reduce/deltas/Delta.cpp
+++ b/llvm/tools/llvm-reduce/deltas/Delta.cpp
@@ -328,9 +328,6 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
       FoundAtLeastOneNewUninterestingChunkWithCurrentGranularity = true;
       UninterestingChunks.insert(ChunkToCheckForUninterestingness);
       ReducedProgram = std::move(Result);
-
-      // FIXME: Report meaningful progress info
-      Test.writeOutput(" **** SUCCESS | Saved new best reduction to ");
     }
     // Delete uninteresting chunks
     erase_if(ChunksStillConsideredInteresting,
@@ -342,8 +339,11 @@ void llvm::runDeltaPass(TestRunner &Test, ReductionFunc ExtractChunksFromModule,
             increaseGranularity(ChunksStillConsideredInteresting)));
 
   // If we reduced the testcase replace it
-  if (ReducedProgram)
+  if (ReducedProgram) {
     Test.setProgram(std::move(ReducedProgram));
+    // FIXME: Report meaningful progress info
+    Test.writeOutput(" **** SUCCESS | Saved new best reduction to ");
+  }
   if (Verbose)
     errs() << "Couldn't increase anymore.\n";
   errs() << "----------------------------\n";


        


More information about the llvm-commits mailing list