aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorMon P Wang <wangmp@apple.com>2011-04-14 19:20:42 +0000
committerMon P Wang <wangmp@apple.com>2011-04-14 19:20:42 +0000
commit481823aa819ea1dd25567ae616dca93056ef770a (patch)
treec6d23cebd429923196e6a085c77acfd834a6f4d2 /lib/Transforms
parentcd695fdac16c206655a19fb1741ab71929f28711 (diff)
Cleanup r129509 based on comments by Chris
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@129532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/ScalarReplAggregates.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp
index ef3f8b2cbc..95c36c93ed 100644
--- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp
+++ b/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<VectorType>(FromType);
- const VectorType *ToVTy = dyn_cast<VectorType>(ToType);
- assert(FromVTy && ToVTy &&
- (ToVTy->getElementType() == FromVTy->getElementType()) &&
+ const VectorType *FromVTy = cast<VectorType>(FromType);
+ const VectorType *ToVTy = cast<VectorType>(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<Constant*, 3> 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);
}