aboutsummaryrefslogtreecommitdiff
path: root/tools/bugpoint
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /tools/bugpoint
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
downloadsrc-01095a5d43bbfde13731688ddcf6048ebb8b7721.tar.gz
src-01095a5d43bbfde13731688ddcf6048ebb8b7721.zip
Vendor import of llvm release_39 branch r276489:vendor/llvm/llvm-release_39-r276489
Notes
Notes: svn path=/vendor/llvm/dist/; revision=303231 svn path=/vendor/llvm/llvm-release_39-r276489/; revision=303232; tag=vendor/llvm/llvm-release_39-r276489
Diffstat (limited to 'tools/bugpoint')
-rw-r--r--tools/bugpoint/BugDriver.h35
-rw-r--r--tools/bugpoint/CrashDebugger.cpp153
-rw-r--r--tools/bugpoint/ExecutionDriver.cpp2
-rw-r--r--tools/bugpoint/ExtractFunction.cpp4
-rw-r--r--tools/bugpoint/Makefile18
-rw-r--r--tools/bugpoint/Miscompilation.cpp23
-rw-r--r--tools/bugpoint/OptimizerDriver.cpp9
-rw-r--r--tools/bugpoint/ToolRunner.cpp13
-rw-r--r--tools/bugpoint/bugpoint.cpp4
9 files changed, 127 insertions, 134 deletions
diff --git a/tools/bugpoint/BugDriver.h b/tools/bugpoint/BugDriver.h
index 20efff3fda5f..52ec2c005649 100644
--- a/tools/bugpoint/BugDriver.h
+++ b/tools/bugpoint/BugDriver.h
@@ -76,7 +76,7 @@ public:
// command line arguments into instance variables of BugDriver.
//
bool addSources(const std::vector<std::string> &FileNames);
- void addPass(std::string p) { PassesToRun.push_back(p); }
+ void addPass(std::string p) { PassesToRun.push_back(std::move(p)); }
void setPassesToRun(const std::vector<std::string> &PTR) {
PassesToRun = PTR;
}
@@ -130,12 +130,6 @@ public:
///
bool isExecutingJIT();
- /// runPasses - Run all of the passes in the "PassesToRun" list, discard the
- /// output, and return true if any of the passes crashed.
- bool runPasses(Module *M) const {
- return runPasses(M, PassesToRun);
- }
-
Module *getProgram() const { return Program; }
/// swapProgramIn - Set the current module to the specified module, returning
@@ -183,7 +177,7 @@ public:
/// Error.
///
std::string executeProgramSafely(const Module *Program,
- std::string OutputFile,
+ const std::string &OutputFile,
std::string *Error) const;
/// createReferenceFile - calls compileProgram and then records the output
@@ -243,12 +237,8 @@ public:
/// Carefully run the specified set of pass on the specified/ module,
/// returning the transformed module on success, or a null pointer on failure.
- /// If AutoDebugCrashes is set to true, then bugpoint will automatically
- /// attempt to track down a crashing pass if one exists, and this method will
- /// never return null.
std::unique_ptr<Module> runPassesOn(Module *M,
const std::vector<std::string> &Passes,
- bool AutoDebugCrashes = false,
unsigned NumExtraArgs = 0,
const char *const *ExtraArgs = nullptr);
@@ -266,6 +256,16 @@ public:
std::string &OutputFilename, bool DeleteOutput = false,
bool Quiet = false, unsigned NumExtraArgs = 0,
const char * const *ExtraArgs = nullptr) const;
+
+ /// runPasses - Just like the method above, but this just returns true or
+ /// false indicating whether or not the optimizer crashed on the specified
+ /// input (true = crashed). Does not produce any output.
+ ///
+ bool runPasses(Module *M,
+ const std::vector<std::string> &PassesToRun) const {
+ std::string Filename;
+ return runPasses(M, PassesToRun, Filename, true);
+ }
/// runManyPasses - Take the specified pass list and create different
/// combinations of passes to compile the program with. Compile the program with
@@ -285,17 +285,6 @@ public:
const Module *M) const;
private:
- /// runPasses - Just like the method above, but this just returns true or
- /// false indicating whether or not the optimizer crashed on the specified
- /// input (true = crashed).
- ///
- bool runPasses(Module *M,
- const std::vector<std::string> &PassesToRun,
- bool DeleteOutput = true) const {
- std::string Filename;
- return runPasses(M, PassesToRun, Filename, DeleteOutput);
- }
-
/// initializeExecutionEnvironment - This method is used to set up the
/// environment for executing LLVM programs.
///
diff --git a/tools/bugpoint/CrashDebugger.cpp b/tools/bugpoint/CrashDebugger.cpp
index 6cdc43ab8699..b25e6ecec19b 100644
--- a/tools/bugpoint/CrashDebugger.cpp
+++ b/tools/bugpoint/CrashDebugger.cpp
@@ -54,6 +54,9 @@ namespace {
cl::opt<bool> NoNamedMDRM("disable-namedmd-remove",
cl::desc("Do not remove global named metadata"),
cl::init(false));
+ cl::opt<bool> VerboseErrors("verbose-errors",
+ cl::desc("Print the output of crashing program"),
+ cl::init(false));
}
namespace llvm {
@@ -164,6 +167,7 @@ ReduceCrashingGlobalVariables::TestGlobalVariables(
if (I.hasInitializer() && !GVSet.count(&I)) {
DeleteGlobalInitializer(&I);
I.setLinkage(GlobalValue::ExternalLinkage);
+ I.setComdat(nullptr);
}
// Try running the hacked up program...
@@ -264,8 +268,8 @@ bool ReduceCrashingFunctions::TestFuncs(std::vector<Function*> &Funcs) {
std::vector<GlobalValue*> ToRemove;
// First, remove aliases to functions we're about to purge.
for (GlobalAlias &Alias : M->aliases()) {
- Constant *Root = Alias.getAliasee()->stripPointerCasts();
- Function *F = dyn_cast<Function>(Root);
+ GlobalObject *Root = Alias.getBaseObject();
+ Function *F = dyn_cast_or_null<Function>(Root);
if (F) {
if (Functions.count(F))
// We're keeping this function.
@@ -373,9 +377,9 @@ bool ReduceCrashingBlocks::TestBlocks(std::vector<const BasicBlock*> &BBs) {
(*SI)->removePredecessor(&*BB);
TerminatorInst *BBTerm = BB->getTerminator();
- if (BBTerm->isEHPad())
+ if (BBTerm->isEHPad() || BBTerm->getType()->isTokenTy())
continue;
- if (!BBTerm->getType()->isVoidTy() && !BBTerm->getType()->isTokenTy())
+ if (!BBTerm->getType()->isVoidTy())
BBTerm->replaceAllUsesWith(Constant::getNullValue(BBTerm->getType()));
// Replace the old terminator instruction.
@@ -459,7 +463,7 @@ bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*>
Module *M = CloneModule(BD.getProgram(), VMap).release();
// Convert list to set for fast lookup...
- SmallPtrSet<Instruction*, 64> Instructions;
+ SmallPtrSet<Instruction*, 32> Instructions;
for (unsigned i = 0, e = Insts.size(); i != e; ++i) {
assert(!isa<TerminatorInst>(Insts[i]));
Instructions.insert(cast<Instruction>(VMap[Insts[i]]));
@@ -476,8 +480,8 @@ bool ReduceCrashingInstructions::TestInsts(std::vector<const Instruction*>
for (BasicBlock::iterator I = FI->begin(), E = FI->end(); I != E;) {
Instruction *Inst = &*I++;
if (!Instructions.count(Inst) && !isa<TerminatorInst>(Inst) &&
- !Inst->isEHPad()) {
- if (!Inst->getType()->isVoidTy() && !Inst->getType()->isTokenTy())
+ !Inst->isEHPad() && !Inst->getType()->isTokenTy()) {
+ if (!Inst->getType()->isVoidTy())
Inst->replaceAllUsesWith(UndefValue::get(Inst->getType()));
Inst->eraseFromParent();
}
@@ -552,7 +556,9 @@ bool ReduceCrashingNamedMD::TestNamedMDs(std::vector<std::string> &NamedMDs) {
std::vector<NamedMDNode *> ToDelete;
ToDelete.reserve(M->named_metadata_size() - Names.size());
for (auto &NamedMD : M->named_metadata())
- if (!Names.count(NamedMD.getName()))
+ // Always keep a nonempty llvm.dbg.cu because the Verifier would complain.
+ if (!Names.count(NamedMD.getName()) &&
+ (!(NamedMD.getName() == "llvm.dbg.cu" && NamedMD.getNumOperands() > 0)))
ToDelete.push_back(&NamedMD);
for (auto *NamedMD : ToDelete)
@@ -600,7 +606,7 @@ public:
bool ReduceCrashingNamedMDOps::TestNamedMDOps(
std::vector<const MDNode *> &NamedMDOps) {
// Convert list to set for fast lookup...
- SmallPtrSet<const MDNode *, 64> OldMDNodeOps;
+ SmallPtrSet<const MDNode *, 32> OldMDNodeOps;
for (unsigned i = 0, e = NamedMDOps.size(); i != e; ++i) {
OldMDNodeOps.insert(NamedMDOps[i]);
}
@@ -637,7 +643,7 @@ bool ReduceCrashingNamedMDOps::TestNamedMDOps(
// module, and that they don't include any deleted blocks.
NamedMDOps.clear();
for (const MDNode *Node : OldMDNodeOps)
- NamedMDOps.push_back(cast<MDNode>(VMap.MD()[Node].get()));
+ NamedMDOps.push_back(cast<MDNode>(*VMap.getMappedMD(Node)));
BD.setNewProgram(M); // It crashed, keep the trimmed version...
return true;
@@ -646,16 +652,10 @@ bool ReduceCrashingNamedMDOps::TestNamedMDOps(
return false;
}
-/// DebugACrash - Given a predicate that determines whether a component crashes
-/// on a program, try to destructively reduce the program while still keeping
-/// the predicate true.
-static bool DebugACrash(BugDriver &BD,
- bool (*TestFn)(const BugDriver &, Module *),
- std::string &Error) {
- // See if we can get away with nuking some of the global variable initializers
- // in the program...
- if (!NoGlobalRM &&
- BD.getProgram()->global_begin() != BD.getProgram()->global_end()) {
+static void ReduceGlobalInitializers(BugDriver &BD,
+ bool (*TestFn)(const BugDriver &, Module *),
+ std::string &Error) {
+ if (BD.getProgram()->global_begin() != BD.getProgram()->global_end()) {
// Now try to reduce the number of global variable initializers in the
// module to something small.
Module *M = CloneModule(BD.getProgram()).release();
@@ -666,6 +666,7 @@ static bool DebugACrash(BugDriver &BD,
if (I->hasInitializer()) {
DeleteGlobalInitializer(&*I);
I->setLinkage(GlobalValue::ExternalLinkage);
+ I->setComdat(nullptr);
DeletedInit = true;
}
@@ -695,8 +696,7 @@ static bool DebugACrash(BugDriver &BD,
unsigned OldSize = GVs.size();
ReduceCrashingGlobalVariables(BD, TestFn).reduceList(GVs, Error);
- if (!Error.empty())
- return true;
+ assert(!Error.empty());
if (GVs.size() < OldSize)
BD.EmitProgressBitcode(BD.getProgram(), "reduced-global-variables");
@@ -704,40 +704,11 @@ static bool DebugACrash(BugDriver &BD,
}
}
}
+}
- // Now try to reduce the number of functions in the module to something small.
- std::vector<Function*> Functions;
- for (Function &F : *BD.getProgram())
- if (!F.isDeclaration())
- Functions.push_back(&F);
-
- if (Functions.size() > 1 && !BugpointIsInterrupted) {
- outs() << "\n*** Attempting to reduce the number of functions "
- "in the testcase\n";
-
- unsigned OldSize = Functions.size();
- ReduceCrashingFunctions(BD, TestFn).reduceList(Functions, Error);
-
- if (Functions.size() < OldSize)
- BD.EmitProgressBitcode(BD.getProgram(), "reduced-function");
- }
-
- // Attempt to delete entire basic blocks at a time to speed up
- // convergence... this actually works by setting the terminator of the blocks
- // to a return instruction then running simplifycfg, which can potentially
- // shrinks the code dramatically quickly
- //
- if (!DisableSimplifyCFG && !BugpointIsInterrupted) {
- std::vector<const BasicBlock*> Blocks;
- for (Function &F : *BD.getProgram())
- for (BasicBlock &BB : F)
- Blocks.push_back(&BB);
- unsigned OldSize = Blocks.size();
- ReduceCrashingBlocks(BD, TestFn).reduceList(Blocks, Error);
- if (Blocks.size() < OldSize)
- BD.EmitProgressBitcode(BD.getProgram(), "reduced-blocks");
- }
-
+static void ReduceInsts(BugDriver &BD,
+ bool (*TestFn)(const BugDriver &, Module *),
+ std::string &Error) {
// Attempt to delete instructions using bisection. This should help out nasty
// cases with large basic blocks where the problem is at one end.
if (!BugpointIsInterrupted) {
@@ -751,11 +722,10 @@ static bool DebugACrash(BugDriver &BD,
ReduceCrashingInstructions(BD, TestFn).reduceList(Insts, Error);
}
- // FIXME: This should use the list reducer to converge faster by deleting
- // larger chunks of instructions at a time!
unsigned Simplification = 2;
do {
- if (BugpointIsInterrupted) break;
+ if (BugpointIsInterrupted)
+ return;
--Simplification;
outs() << "\n*** Attempting to reduce testcase by deleting instruc"
<< "tions: Simplification Level #" << Simplification << '\n';
@@ -784,7 +754,8 @@ static bool DebugACrash(BugDriver &BD,
if (InstructionsToSkipBeforeDeleting) {
--InstructionsToSkipBeforeDeleting;
} else {
- if (BugpointIsInterrupted) goto ExitLoops;
+ if (BugpointIsInterrupted)
+ return;
if (I->isEHPad() || I->getType()->isTokenTy())
continue;
@@ -810,10 +781,60 @@ static bool DebugACrash(BugDriver &BD,
}
} while (Simplification);
+ BD.EmitProgressBitcode(BD.getProgram(), "reduced-instructions");
+}
- if (!NoNamedMDRM) {
- BD.EmitProgressBitcode(BD.getProgram(), "reduced-instructions");
+/// DebugACrash - Given a predicate that determines whether a component crashes
+/// on a program, try to destructively reduce the program while still keeping
+/// the predicate true.
+static bool DebugACrash(BugDriver &BD,
+ bool (*TestFn)(const BugDriver &, Module *),
+ std::string &Error) {
+ // See if we can get away with nuking some of the global variable initializers
+ // in the program...
+ if (!NoGlobalRM)
+ ReduceGlobalInitializers(BD, TestFn, Error);
+
+ // Now try to reduce the number of functions in the module to something small.
+ std::vector<Function*> Functions;
+ for (Function &F : *BD.getProgram())
+ if (!F.isDeclaration())
+ Functions.push_back(&F);
+
+ if (Functions.size() > 1 && !BugpointIsInterrupted) {
+ outs() << "\n*** Attempting to reduce the number of functions "
+ "in the testcase\n";
+
+ unsigned OldSize = Functions.size();
+ ReduceCrashingFunctions(BD, TestFn).reduceList(Functions, Error);
+
+ if (Functions.size() < OldSize)
+ BD.EmitProgressBitcode(BD.getProgram(), "reduced-function");
+ }
+
+ // Attempt to delete entire basic blocks at a time to speed up
+ // convergence... this actually works by setting the terminator of the blocks
+ // to a return instruction then running simplifycfg, which can potentially
+ // shrinks the code dramatically quickly
+ //
+ if (!DisableSimplifyCFG && !BugpointIsInterrupted) {
+ std::vector<const BasicBlock*> Blocks;
+ for (Function &F : *BD.getProgram())
+ for (BasicBlock &BB : F)
+ Blocks.push_back(&BB);
+ unsigned OldSize = Blocks.size();
+ ReduceCrashingBlocks(BD, TestFn).reduceList(Blocks, Error);
+ if (Blocks.size() < OldSize)
+ BD.EmitProgressBitcode(BD.getProgram(), "reduced-blocks");
+ }
+
+ // Attempt to delete instructions using bisection. This should help out nasty
+ // cases with large basic blocks where the problem is at one end.
+ if (!BugpointIsInterrupted)
+ ReduceInsts(BD, TestFn, Error);
+
+ if (!NoNamedMDRM) {
if (!BugpointIsInterrupted) {
// Try to reduce the amount of global metadata (particularly debug info),
// by dropping global named metadata that anchors them
@@ -833,10 +854,9 @@ static bool DebugACrash(BugDriver &BD,
NamedMDOps.push_back(op);
ReduceCrashingNamedMDOps(BD, TestFn).reduceList(NamedMDOps, Error);
}
+ BD.EmitProgressBitcode(BD.getProgram(), "reduced-named-md");
}
-ExitLoops:
-
// Try to clean up the testcase by running funcresolve and globaldce...
if (!BugpointIsInterrupted) {
outs() << "\n*** Attempting to perform final cleanups: ";
@@ -857,7 +877,7 @@ ExitLoops:
}
static bool TestForOptimizerCrash(const BugDriver &BD, Module *M) {
- return BD.runPasses(M);
+ return BD.runPasses(M, BD.getPassesToRun());
}
/// debugOptimizerCrash - This method is called when some pass crashes on input.
@@ -888,7 +908,10 @@ static bool TestForCodeGenCrash(const BugDriver &BD, Module *M) {
std::string Error;
BD.compileProgram(M, &Error);
if (!Error.empty()) {
- errs() << "<crash>\n";
+ if (VerboseErrors)
+ errs() << Error << "\n";
+ else
+ errs() << "<crash>\n";
return true; // Tool is still crashing.
}
errs() << '\n';
diff --git a/tools/bugpoint/ExecutionDriver.cpp b/tools/bugpoint/ExecutionDriver.cpp
index 41b8ccc18e87..ab9c05fa924a 100644
--- a/tools/bugpoint/ExecutionDriver.cpp
+++ b/tools/bugpoint/ExecutionDriver.cpp
@@ -384,7 +384,7 @@ std::string BugDriver::executeProgram(const Module *Program,
/// backend, if reference output is not provided.
///
std::string BugDriver::executeProgramSafely(const Module *Program,
- std::string OutputFile,
+ const std::string &OutputFile,
std::string *Error) const {
return executeProgram(Program, OutputFile, "", "", SafeInterpreter, Error);
}
diff --git a/tools/bugpoint/ExtractFunction.cpp b/tools/bugpoint/ExtractFunction.cpp
index fe0ab69dc162..de596a57d83c 100644
--- a/tools/bugpoint/ExtractFunction.cpp
+++ b/tools/bugpoint/ExtractFunction.cpp
@@ -215,6 +215,8 @@ void llvm::DeleteGlobalInitializer(GlobalVariable *GV) {
//
void llvm::DeleteFunctionBody(Function *F) {
eliminateAliases(F);
+ // Function declarations can't have comdats.
+ F->setComdat(nullptr);
// delete the body of the function...
F->deleteBody();
@@ -409,7 +411,7 @@ BugDriver::extractMappedBlocksFromModule(const std::vector<BasicBlock *> &BBs,
std::vector<std::string> PI;
PI.push_back("extract-blocks");
- std::unique_ptr<Module> Ret = runPassesOn(M, PI, false, 1, &ExtraArg);
+ std::unique_ptr<Module> Ret = runPassesOn(M, PI, 1, &ExtraArg);
sys::fs::remove(Filename.c_str());
diff --git a/tools/bugpoint/Makefile b/tools/bugpoint/Makefile
deleted file mode 100644
index 174f8d25161e..000000000000
--- a/tools/bugpoint/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-##===- tools/bugpoint/Makefile -----------------------------*- Makefile -*-===##
-#
-# The LLVM Compiler Infrastructure
-#
-# This file is distributed under the University of Illinois Open Source
-# License. See LICENSE.TXT for details.
-#
-##===----------------------------------------------------------------------===##
-
-LEVEL := ../..
-TOOLNAME := bugpoint
-LINK_COMPONENTS := asmparser instrumentation scalaropts ipo linker bitreader \
- bitwriter irreader vectorize objcarcopts codegen
-
-# Support plugins.
-NO_DEAD_STRIP := 1
-
-include $(LEVEL)/Makefile.common
diff --git a/tools/bugpoint/Miscompilation.cpp b/tools/bugpoint/Miscompilation.cpp
index 16919f5a4492..40955ed3caa9 100644
--- a/tools/bugpoint/Miscompilation.cpp
+++ b/tools/bugpoint/Miscompilation.cpp
@@ -26,12 +26,13 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileUtilities.h"
#include "llvm/Transforms/Utils/Cloning.h"
+
using namespace llvm;
namespace llvm {
extern cl::opt<std::string> OutputPrefix;
extern cl::list<std::string> InputArgv;
-}
+} // end namespace llvm
namespace {
static llvm::cl::opt<bool>
@@ -52,7 +53,7 @@ namespace {
std::vector<std::string> &Suffix,
std::string &Error) override;
};
-}
+} // end anonymous namespace
/// TestResult - After passes have been split into a test group and a control
/// group, see if they still break the program.
@@ -208,7 +209,7 @@ namespace {
bool TestFuncs(const std::vector<Function*> &Prefix, std::string &Error);
};
-}
+} // end anonymous namespace
/// Given two modules, link them together and run the program, checking to see
/// if the program matches the diff. If there is an error, return NULL. If not,
@@ -469,7 +470,7 @@ namespace {
bool TestFuncs(const std::vector<BasicBlock*> &BBs, std::string &Error);
};
-}
+} // end anonymous namespace
/// TestFuncs - Extract all blocks for the miscompiled functions except for the
/// specified blocks. If the problem still exists, return true.
@@ -696,8 +697,14 @@ static bool TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test,
// of the functions being tested.
outs() << " Optimizing functions being tested: ";
std::unique_ptr<Module> Optimized =
- BD.runPassesOn(Test.get(), BD.getPassesToRun(),
- /*AutoDebugCrashes*/ true);
+ BD.runPassesOn(Test.get(), BD.getPassesToRun());
+ if (!Optimized) {
+ errs() << " Error running this sequence of passes"
+ << " on the input program!\n";
+ delete BD.swapProgramIn(Test.get());
+ BD.EmitProgressBitcode(Test.get(), "pass-error", false);
+ return BD.debugOptimizerCrash();
+ }
outs() << "done.\n";
outs() << " Checking to see if the merged program executes correctly: ";
@@ -712,7 +719,6 @@ static bool TestOptimizer(BugDriver &BD, std::unique_ptr<Module> Test,
return Broken;
}
-
/// debugMiscompilation - This method is used when the passes selected are not
/// crashing, but the generated output is semantically different from the
/// input.
@@ -752,8 +758,6 @@ void BugDriver::debugMiscompilation(std::string *Error) {
outs() << " Portion that is input to optimizer: ";
EmitProgressBitcode(ToOptimize, "tooptimize");
delete ToOptimize; // Delete hacked module.
-
- return;
}
/// Get the specified modules ready for code generator testing.
@@ -984,7 +988,6 @@ static bool TestCodeGenerator(BugDriver &BD, std::unique_ptr<Module> Test,
return Result;
}
-
/// debugCodeGenerator - debug errors in LLC, LLI, or CBE.
///
bool BugDriver::debugCodeGenerator(std::string *Error) {
diff --git a/tools/bugpoint/OptimizerDriver.cpp b/tools/bugpoint/OptimizerDriver.cpp
index 344e7b588fb8..2cc2f4471a58 100644
--- a/tools/bugpoint/OptimizerDriver.cpp
+++ b/tools/bugpoint/OptimizerDriver.cpp
@@ -267,18 +267,11 @@ bool BugDriver::runPasses(Module *Program,
std::unique_ptr<Module>
BugDriver::runPassesOn(Module *M, const std::vector<std::string> &Passes,
- bool AutoDebugCrashes, unsigned NumExtraArgs,
+ unsigned NumExtraArgs,
const char *const *ExtraArgs) {
std::string BitcodeResult;
if (runPasses(M, Passes, BitcodeResult, false/*delete*/, true/*quiet*/,
NumExtraArgs, ExtraArgs)) {
- if (AutoDebugCrashes) {
- errs() << " Error running this sequence of passes"
- << " on the input program!\n";
- delete swapProgramIn(M);
- EmitProgressBitcode(M, "pass-error", false);
- exit(debugOptimizerCrash());
- }
return nullptr;
}
diff --git a/tools/bugpoint/ToolRunner.cpp b/tools/bugpoint/ToolRunner.cpp
index 2ccd64905128..4af4b10c4d78 100644
--- a/tools/bugpoint/ToolRunner.cpp
+++ b/tools/bugpoint/ToolRunner.cpp
@@ -21,6 +21,7 @@
#include "llvm/Support/raw_ostream.h"
#include <fstream>
#include <sstream>
+#include <utility>
using namespace llvm;
#define DEBUG_TYPE "toolrunner"
@@ -272,9 +273,9 @@ namespace {
std::string CompilerCommand;
std::vector<std::string> CompilerArgs;
public:
- CustomCompiler(
- const std::string &CompilerCmd, std::vector<std::string> CompArgs) :
- CompilerCommand(CompilerCmd), CompilerArgs(CompArgs) {}
+ CustomCompiler(const std::string &CompilerCmd,
+ std::vector<std::string> CompArgs)
+ : CompilerCommand(CompilerCmd), CompilerArgs(std::move(CompArgs)) {}
void compileProgram(const std::string &Bitcode,
std::string *Error,
@@ -333,9 +334,9 @@ namespace {
std::string ExecutionCommand;
std::vector<std::string> ExecutorArgs;
public:
- CustomExecutor(
- const std::string &ExecutionCmd, std::vector<std::string> ExecArgs) :
- ExecutionCommand(ExecutionCmd), ExecutorArgs(ExecArgs) {}
+ CustomExecutor(const std::string &ExecutionCmd,
+ std::vector<std::string> ExecArgs)
+ : ExecutionCommand(ExecutionCmd), ExecutorArgs(std::move(ExecArgs)) {}
int ExecuteProgram(const std::string &Bitcode,
const std::vector<std::string> &Args,
diff --git a/tools/bugpoint/bugpoint.cpp b/tools/bugpoint/bugpoint.cpp
index 48f30e6709f8..28565f1daac3 100644
--- a/tools/bugpoint/bugpoint.cpp
+++ b/tools/bugpoint/bugpoint.cpp
@@ -113,7 +113,7 @@ void initializePollyPasses(llvm::PassRegistry &Registry);
int main(int argc, char **argv) {
#ifndef DEBUG_BUGPOINT
- llvm::sys::PrintStackTraceOnErrorSignal();
+ llvm::sys::PrintStackTraceOnErrorSignal(argv[0]);
llvm::PrettyStackTraceProgram X(argc, argv);
llvm_shutdown_obj Y; // Call llvm_shutdown() on exit.
#endif
@@ -143,7 +143,7 @@ int main(int argc, char **argv) {
sys::SetInterruptFunction(BugpointInterruptFunction);
#endif
- LLVMContext& Context = getGlobalContext();
+ LLVMContext Context;
// If we have an override, set it and then track the triple we want Modules
// to use.
if (!OverrideTriple.empty()) {