diff options
Diffstat (limited to 'contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp')
-rw-r--r-- | contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp b/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp index 22f530dde167..538240d65738 100644 --- a/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/contrib/llvm-project/llvm/tools/llvm-stress/llvm-stress.cpp @@ -38,8 +38,7 @@ #include "llvm/Support/CommandLine.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" -#include "llvm/Support/ManagedStatic.h" -#include "llvm/Support/PrettyStackTrace.h" +#include "llvm/Support/InitLLVM.h" #include "llvm/Support/ToolOutputFile.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> @@ -238,7 +237,7 @@ protected: return ConstantFP::getAllOnesValue(Tp); return ConstantFP::getNullValue(Tp); } else if (Tp->isVectorTy()) { - VectorType *VTp = cast<VectorType>(Tp); + auto *VTp = cast<FixedVectorType>(Tp); std::vector<Constant*> TempValues; TempValues.reserve(VTp->getNumElements()); @@ -316,8 +315,7 @@ protected: Type::getFloatTy(Context), Type::getDoubleTy(Context) }); - ScalarTypes.insert(ScalarTypes.end(), - AdditionalScalarTypes.begin(), AdditionalScalarTypes.end()); + llvm::append_range(ScalarTypes, AdditionalScalarTypes); } return ScalarTypes[getRandom() % ScalarTypes.size()]; @@ -483,10 +481,13 @@ struct ExtractElementModifier: public Modifier { void Act() override { Value *Val0 = getRandomVectorValue(); - Value *V = ExtractElementInst::Create(Val0, - ConstantInt::get(Type::getInt32Ty(BB->getContext()), - getRandom() % cast<VectorType>(Val0->getType())->getNumElements()), - "E", BB->getTerminator()); + Value *V = ExtractElementInst::Create( + Val0, + ConstantInt::get( + Type::getInt32Ty(BB->getContext()), + getRandom() % + cast<FixedVectorType>(Val0->getType())->getNumElements()), + "E", BB->getTerminator()); return PT->push_back(V); } }; @@ -499,7 +500,7 @@ struct ShuffModifier: public Modifier { Value *Val0 = getRandomVectorValue(); Value *Val1 = getRandomValue(Val0->getType()); - unsigned Width = cast<VectorType>(Val0->getType())->getNumElements(); + unsigned Width = cast<FixedVectorType>(Val0->getType())->getNumElements(); std::vector<Constant*> Idxs; Type *I32 = Type::getInt32Ty(BB->getContext()); @@ -527,10 +528,13 @@ struct InsertElementModifier: public Modifier { Value *Val0 = getRandomVectorValue(); Value *Val1 = getRandomValue(Val0->getType()->getScalarType()); - Value *V = InsertElementInst::Create(Val0, Val1, - ConstantInt::get(Type::getInt32Ty(BB->getContext()), - getRandom() % cast<VectorType>(Val0->getType())->getNumElements()), - "I", BB->getTerminator()); + Value *V = InsertElementInst::Create( + Val0, Val1, + ConstantInt::get( + Type::getInt32Ty(BB->getContext()), + getRandom() % + cast<FixedVectorType>(Val0->getType())->getNumElements()), + "I", BB->getTerminator()); return PT->push_back(V); } }; @@ -546,7 +550,7 @@ struct CastModifier: public Modifier { // Handle vector casts vectors. if (VTy->isVectorTy()) { - VectorType *VecTy = cast<VectorType>(VTy); + auto *VecTy = cast<FixedVectorType>(VTy); DestTy = pickVectorType(VecTy->getNumElements()); } @@ -733,10 +737,8 @@ static void IntroduceControlFlow(Function *F, Random &R) { int main(int argc, char **argv) { using namespace llvm; - // Init LLVM, call llvm_shutdown() on exit, parse args, etc. - PrettyStackTraceProgram X(argc, argv); + InitLLVM X(argc, argv); cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n"); - llvm_shutdown_obj Y; auto M = std::make_unique<Module>("/tmp/autogen.bc", Context); Function *F = GenEmptyFunction(M.get()); |