From 1cde91674a56da3cfedf42af59cc6455a8fb40a9 Mon Sep 17 00:00:00 2001 From: Mon P Wang Date: Thu, 14 Apr 2011 19:20:42 +0000 Subject: Cleanup r129509 based on comments by Chris llvm-svn: 129532 --- llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp index ef3f8b2cbc1..95c36c93ed6 100644 --- a/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/llvm/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -682,24 +682,23 @@ static const Type *getScaledElementType(const Type *OldTy, static Value *CreateShuffleVectorCast(Value *FromVal, const Type *ToType, IRBuilder<> &Builder) { const Type *FromType = FromVal->getType(); - const VectorType *FromVTy = dyn_cast(FromType); - const VectorType *ToVTy = dyn_cast(ToType); - assert(FromVTy && ToVTy && - (ToVTy->getElementType() == FromVTy->getElementType()) && + const VectorType *FromVTy = cast(FromType); + const VectorType *ToVTy = cast(ToType); + assert((ToVTy->getElementType() == FromVTy->getElementType()) && "Vectors must have the same element type"); - LLVMContext &Context = FromVal->getContext(); Value *UnV = UndefValue::get(FromType); unsigned numEltsFrom = FromVTy->getNumElements(); unsigned numEltsTo = ToVTy->getNumElements(); SmallVector Args; + const Type* Int32Ty = Builder.getInt32Ty(); unsigned minNumElts = std::min(numEltsFrom, numEltsTo); unsigned i; for (i=0; i != minNumElts; ++i) - Args.push_back(ConstantInt::get(Type::getInt32Ty(Context), i)); + Args.push_back(ConstantInt::get(Int32Ty, i)); if (i < numEltsTo) { - Constant* UnC = UndefValue::get(Type::getInt32Ty(Context)); + Constant* UnC = UndefValue::get(Int32Ty); for (; i != numEltsTo; ++i) Args.push_back(UnC); } -- cgit v1.2.3