Index: test/BugPoint/unsymbolized.ll =================================================================== --- test/BugPoint/unsymbolized.ll +++ test/BugPoint/unsymbolized.ll @@ -2,7 +2,7 @@ ; RUN: echo "import sys" > %t.py ; RUN: echo "print('args = ' + str(sys.argv))" >> %t.py ; RUN: echo "exit(1)" >> %t.py -; RUN: not bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s +; RUN: bugpoint -load %llvmshlibdir/BugpointPasses%shlibext %s -output-prefix %t -bugpoint-crashcalls -opt-command="%python" -opt-args %t.py | FileCheck %s ; RUN: not --crash opt -load %llvmshlibdir/BugpointPasses%shlibext %s -bugpoint-crashcalls -disable-symbolication 2>&1 | FileCheck --check-prefix=CRASH %s ; Test that bugpoint disables symbolication on the opt tool to reduce runtime overhead when opt crashes Index: tools/bugpoint/BugDriver.h =================================================================== --- tools/bugpoint/BugDriver.h +++ tools/bugpoint/BugDriver.h @@ -200,7 +200,8 @@ /// This method clones the current Program and deletes the specified /// instruction from the cloned module. It then runs a series of cleanup /// passes (ADCE and SimplifyCFG) to eliminate any code which depends on the - /// value. The modified module is then returned. + /// value. The modified module is then returned. If deletion causes module + /// verification to fail, nullptr is returned. /// std::unique_ptr deleteInstructionFromProgram(const Instruction *I, unsigned Simp); Index: tools/bugpoint/CrashDebugger.cpp =================================================================== --- tools/bugpoint/CrashDebugger.cpp +++ tools/bugpoint/CrashDebugger.cpp @@ -451,7 +451,7 @@ std::unique_ptr New = BD.runPassesOn(M.get(), Passes); if (!New) { errs() << "verify failed!\n"; - exit(1); + return false; } M = std::move(New); @@ -558,7 +558,7 @@ std::unique_ptr New = BD.runPassesOn(M.get(), Passes); if (!New) { errs() << "verify failed!\n"; - exit(1); + return false; } M = std::move(New); @@ -650,7 +650,7 @@ std::unique_ptr New = BD.runPassesOn(M.get(), Passes); if (!New) { errs() << "verify failed!\n"; - exit(1); + return false; } M = std::move(New); @@ -1010,6 +1010,8 @@ outs() << "Checking instruction: " << *I; std::unique_ptr M = BD.deleteInstructionFromProgram(&*I, Simplification); + if (!M) // We couldn't delete this instruction. Keep trying. + continue; // Find out if the pass still crashes on this pass... if (TestFn(BD, M.get())) { Index: tools/bugpoint/ExtractFunction.cpp =================================================================== --- tools/bugpoint/ExtractFunction.cpp +++ tools/bugpoint/ExtractFunction.cpp @@ -121,7 +121,7 @@ std::unique_ptr New = runPassesOn(Clone.get(), Passes); if (!New) { errs() << "Instruction removal failed. Sorry. :( Please report a bug!\n"; - exit(1); + return nullptr; } return New; }