diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp --- a/llvm/tools/bugpoint/CrashDebugger.cpp +++ b/llvm/tools/bugpoint/CrashDebugger.cpp @@ -368,6 +368,13 @@ if (F->hasFnAttribute(Attribute::OptimizeNone)) F->addFnAttr(Attribute::NoInline); + // If modifying the attribute list leads to invalid IR, revert the change + std::vector Passes; + Passes.push_back("verify"); + std::unique_ptr New = BD.runPassesOn(M.get(), Passes); + if (!New) + return false; + // Try running on the hacked up program... if (TestFn(BD, M.get())) { BD.setNewProgram(std::move(M)); // It crashed, keep the trimmed version...