summaryrefslogtreecommitdiff
path: root/tools/llvm-stress/llvm-stress.cpp
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/llvm-stress/llvm-stress.cpp
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Diffstat (limited to 'tools/llvm-stress/llvm-stress.cpp')
-rw-r--r--tools/llvm-stress/llvm-stress.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index 99d2afdcd3012..0b887ea9b4cd4 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -17,10 +17,10 @@
#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassManager.h"
#include "llvm/IR/LegacyPassNameParser.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Verifier.h"
-#include "llvm/IR/LegacyPassManager.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/ManagedStatic.h"
@@ -28,8 +28,6 @@
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/ToolOutputFile.h"
#include <algorithm>
-#include <set>
-#include <sstream>
#include <vector>
namespace llvm {
@@ -43,6 +41,8 @@ static cl::opt<std::string>
OutputFilename("o", cl::desc("Override output filename"),
cl::value_desc("filename"));
+static LLVMContext Context;
+
namespace cl {
template <> class parser<Type*> final : public basic_parser<Type*> {
public:
@@ -50,7 +50,6 @@ public:
// Parse options as IR types. Return true on error.
bool parse(Option &O, StringRef, StringRef Arg, Type *&Value) {
- auto &Context = getGlobalContext();
if (Arg == "half") Value = Type::getHalfTy(Context);
else if (Arg == "fp128") Value = Type::getFP128Ty(Context);
else if (Arg == "x86_fp80") Value = Type::getX86_FP80Ty(Context);
@@ -687,7 +686,7 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n");
llvm_shutdown_obj Y;
- auto M = make_unique<Module>("/tmp/autogen.bc", getGlobalContext());
+ auto M = make_unique<Module>("/tmp/autogen.bc", Context);
Function *F = GenEmptyFunction(M.get());
// Pick an initial seed value