aboutsummaryrefslogtreecommitdiffstats
path: root/tools/llvm-stress
diff options
context:
space:
mode:
authorStephen Hines <srhines@google.com>2014-04-23 16:57:46 -0700
committerStephen Hines <srhines@google.com>2014-04-24 15:53:16 -0700
commit36b56886974eae4f9c5ebc96befd3e7bfe5de338 (patch)
treee6cfb69fbbd937f450eeb83bfb83b9da3b01275a /tools/llvm-stress
parent69a8640022b04415ae9fac62f8ab090601d8f889 (diff)
downloadexternal_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.zip
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.gz
external_llvm-36b56886974eae4f9c5ebc96befd3e7bfe5de338.tar.bz2
Update to LLVM 3.5a.
Change-Id: Ifadecab779f128e62e430c2b4f6ddd84953ed617
Diffstat (limited to 'tools/llvm-stress')
-rw-r--r--tools/llvm-stress/CMakeLists.txt7
-rw-r--r--tools/llvm-stress/Makefile3
-rw-r--r--tools/llvm-stress/llvm-stress.cpp62
3 files changed, 37 insertions, 35 deletions
diff --git a/tools/llvm-stress/CMakeLists.txt b/tools/llvm-stress/CMakeLists.txt
index e2d07a5..106ced1 100644
--- a/tools/llvm-stress/CMakeLists.txt
+++ b/tools/llvm-stress/CMakeLists.txt
@@ -1,5 +1,10 @@
-set(LLVM_LINK_COMPONENTS bitreader asmparser bitwriter instrumentation scalaropts ipo)
+set(LLVM_LINK_COMPONENTS
+ Core
+ IPA
+ Support
+ )
add_llvm_tool(llvm-stress
llvm-stress.cpp
)
+set_target_properties(llvm-stress PROPERTIES ENABLE_EXPORTS 1)
diff --git a/tools/llvm-stress/Makefile b/tools/llvm-stress/Makefile
index 8767cbe..29245af 100644
--- a/tools/llvm-stress/Makefile
+++ b/tools/llvm-stress/Makefile
@@ -12,7 +12,4 @@ TOOLNAME := llvm-stress
LINK_COMPONENTS := object
LINK_COMPONENTS := bitreader bitwriter asmparser irreader instrumentation scalaropts ipo
-# This tool has no plugins, optimize startup time.
-TOOL_NO_EXPORTS = 1
-
include $(LEVEL)/Makefile.common
diff --git a/tools/llvm-stress/llvm-stress.cpp b/tools/llvm-stress/llvm-stress.cpp
index fd10baf..18f1e6c 100644
--- a/tools/llvm-stress/llvm-stress.cpp
+++ b/tools/llvm-stress/llvm-stress.cpp
@@ -11,18 +11,18 @@
// different components in LLVM.
//
//===----------------------------------------------------------------------===//
-#include "llvm/IR/LLVMContext.h"
-#include "llvm/ADT/OwningPtr.h"
+
#include "llvm/Analysis/CallGraphSCCPass.h"
-#include "llvm/Analysis/Verifier.h"
-#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/IR/Constants.h"
+#include "llvm/IR/IRPrintingPasses.h"
#include "llvm/IR/Instruction.h"
+#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/LegacyPassNameParser.h"
#include "llvm/IR/Module.h"
+#include "llvm/IR/Verifier.h"
#include "llvm/PassManager.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ManagedStatic.h"
-#include "llvm/Support/PassNameParser.h"
#include "llvm/Support/PluginLoader.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/ToolOutputFile.h"
@@ -288,8 +288,8 @@ protected:
struct LoadModifier: public Modifier {
LoadModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
- // Try to use predefined pointers. If non exist, use undef pointer value;
+ void Act() override {
+ // Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
Value *V = new LoadInst(Ptr, "L", BB->getTerminator());
PT->push_back(V);
@@ -298,8 +298,8 @@ struct LoadModifier: public Modifier {
struct StoreModifier: public Modifier {
StoreModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
- // Try to use predefined pointers. If non exist, use undef pointer value;
+ void Act() override {
+ // Try to use predefined pointers. If non-exist, use undef pointer value;
Value *Ptr = getRandomPointerValue();
Type *Tp = Ptr->getType();
Value *Val = getRandomValue(Tp->getContainedType(0));
@@ -317,7 +317,7 @@ struct StoreModifier: public Modifier {
struct BinModifier: public Modifier {
BinModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType());
@@ -360,7 +360,7 @@ struct BinModifier: public Modifier {
/// Generate constant values.
struct ConstModifier: public Modifier {
ConstModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Type *Ty = pickType();
if (Ty->isVectorTy()) {
@@ -407,7 +407,7 @@ struct ConstModifier: public Modifier {
struct AllocaModifier: public Modifier {
AllocaModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R){}
- virtual void Act() {
+ void Act() override {
Type *Tp = pickType();
PT->push_back(new AllocaInst(Tp, "A", BB->getFirstNonPHI()));
}
@@ -417,7 +417,7 @@ struct ExtractElementModifier: public Modifier {
ExtractElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *Val0 = getRandomVectorValue();
Value *V = ExtractElementInst::Create(Val0,
ConstantInt::get(Type::getInt32Ty(BB->getContext()),
@@ -429,7 +429,7 @@ struct ExtractElementModifier: public Modifier {
struct ShuffModifier: public Modifier {
ShuffModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *Val0 = getRandomVectorValue();
Value *Val1 = getRandomValue(Val0->getType());
@@ -458,7 +458,7 @@ struct InsertElementModifier: public Modifier {
InsertElementModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *Val0 = getRandomVectorValue();
Value *Val1 = getRandomValue(Val0->getType()->getScalarType());
@@ -473,7 +473,7 @@ struct InsertElementModifier: public Modifier {
struct CastModifier: public Modifier {
CastModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *V = getRandomVal();
Type *VTy = V->getType();
@@ -560,7 +560,7 @@ struct SelectModifier: public Modifier {
SelectModifier(BasicBlock *BB, PieceTable *PT, Random *R):
Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
// Try a bunch of different select configuration until a valid one is found.
Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType());
@@ -583,7 +583,7 @@ struct SelectModifier: public Modifier {
struct CmpModifier: public Modifier {
CmpModifier(BasicBlock *BB, PieceTable *PT, Random *R):Modifier(BB, PT, R) {}
- virtual void Act() {
+ void Act() override {
Value *Val0 = getRandomVal();
Value *Val1 = getRandomValue(Val0->getType());
@@ -625,15 +625,15 @@ static void FillFunction(Function *F, Random &R) {
// List of modifiers which add new random instructions.
std::vector<Modifier*> Modifiers;
- OwningPtr<Modifier> LM(new LoadModifier(BB, &PT, &R));
- OwningPtr<Modifier> SM(new StoreModifier(BB, &PT, &R));
- OwningPtr<Modifier> EE(new ExtractElementModifier(BB, &PT, &R));
- OwningPtr<Modifier> SHM(new ShuffModifier(BB, &PT, &R));
- OwningPtr<Modifier> IE(new InsertElementModifier(BB, &PT, &R));
- OwningPtr<Modifier> BM(new BinModifier(BB, &PT, &R));
- OwningPtr<Modifier> CM(new CastModifier(BB, &PT, &R));
- OwningPtr<Modifier> SLM(new SelectModifier(BB, &PT, &R));
- OwningPtr<Modifier> PM(new CmpModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> LM(new LoadModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SM(new StoreModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> EE(new ExtractElementModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SHM(new ShuffModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> IE(new InsertElementModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> BM(new BinModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> CM(new CastModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> SLM(new SelectModifier(BB, &PT, &R));
+ std::unique_ptr<Modifier> PM(new CmpModifier(BB, &PT, &R));
Modifiers.push_back(LM.get());
Modifiers.push_back(SM.get());
Modifiers.push_back(EE.get());
@@ -687,7 +687,7 @@ int main(int argc, char **argv) {
cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n");
llvm_shutdown_obj Y;
- OwningPtr<Module> M(new Module("/tmp/autogen.bc", getGlobalContext()));
+ std::unique_ptr<Module> M(new Module("/tmp/autogen.bc", getGlobalContext()));
Function *F = GenEmptyFunction(M.get());
// Pick an initial seed value
@@ -698,14 +698,14 @@ int main(int argc, char **argv) {
IntroduceControlFlow(F, R);
// Figure out what stream we are supposed to write to...
- OwningPtr<tool_output_file> Out;
+ std::unique_ptr<tool_output_file> Out;
// Default to standard output.
if (OutputFilename.empty())
OutputFilename = "-";
std::string ErrorInfo;
Out.reset(new tool_output_file(OutputFilename.c_str(), ErrorInfo,
- sys::fs::F_Binary));
+ sys::fs::F_None));
if (!ErrorInfo.empty()) {
errs() << ErrorInfo << '\n';
return 1;
@@ -713,7 +713,7 @@ int main(int argc, char **argv) {
PassManager Passes;
Passes.add(createVerifierPass());
- Passes.add(createPrintModulePass(&Out->os()));
+ Passes.add(createPrintModulePass(Out->os()));
Passes.run(*M.get());
Out->keep();