[llvm] r361279 - [Bugpoint] fix use-after-move. NFC

Nick Desaulniers via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 10:55:26 PDT 2019


Author: nickdesaulniers
Date: Tue May 21 10:55:26 2019
New Revision: 361279

URL: http://llvm.org/viewvc/llvm-project?rev=361279&view=rev
Log:
[Bugpoint] fix use-after-move. NFC

Summary:
This was flagged in https://www.viva64.com/en/b/0629/ under "Snippet No.
6".

Note that author also states:
"Note that the loop doesn't actually execute at all."

This is not true, but the author can be forgiven; there's two distinct
variables with very similar identifiers:

MiscompiledFunctions
MisCompFunctions

Reviewers: echristo, srhines, RKSimon

Reviewed By: RKSimon

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D62113

Modified:
    llvm/trunk/tools/bugpoint/Miscompilation.cpp

Modified: llvm/trunk/tools/bugpoint/Miscompilation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/bugpoint/Miscompilation.cpp?rev=361279&r1=361278&r2=361279&view=diff
==============================================================================
--- llvm/trunk/tools/bugpoint/Miscompilation.cpp (original)
+++ llvm/trunk/tools/bugpoint/Miscompilation.cpp Tue May 21 10:55:26 2019
@@ -591,9 +591,6 @@ ExtractBlocks(BugDriver &BD,
   if (Linker::linkModules(*ProgClone, std::move(Extracted)))
     exit(1);
 
-  // Set the new program and delete the old one.
-  BD.setNewProgram(std::move(ProgClone));
-
   // Update the list of miscompiled functions.
   MiscompiledFunctions.clear();
 
@@ -603,6 +600,9 @@ ExtractBlocks(BugDriver &BD,
     MiscompiledFunctions.push_back(NewF);
   }
 
+  // Set the new program and delete the old one.
+  BD.setNewProgram(std::move(ProgClone));
+
   return true;
 }
 




More information about the llvm-commits mailing list