]> granicus.if.org Git - llvm/commitdiff
[Bugpoint] fix use-after-move. NFC
authorNick Desaulniers <ndesaulniers@google.com>
Tue, 21 May 2019 17:55:26 +0000 (17:55 +0000)
committerNick Desaulniers <ndesaulniers@google.com>
Tue, 21 May 2019 17:55:26 +0000 (17:55 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@361279 91177308-0d34-0410-b5e6-96231b3b80d8

tools/bugpoint/Miscompilation.cpp

index b7477149c61f424334f8447c6966bead889cb844..56fb015bdcc595b6ed1264965f5e3e35bb923c5f 100644 (file)
@@ -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;
 }