diff --git a/llvm/tools/bugpoint/Miscompilation.cpp b/llvm/tools/bugpoint/Miscompilation.cpp --- a/llvm/tools/bugpoint/Miscompilation.cpp +++ b/llvm/tools/bugpoint/Miscompilation.cpp @@ -591,9 +591,6 @@ 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 @@ MiscompiledFunctions.push_back(NewF); } + // Set the new program and delete the old one. + BD.setNewProgram(std::move(ProgClone)); + return true; }