aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineCasts.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-14 07:55:32 +0000
committerChris Lattner <sabre@nondot.org>2011-02-14 07:55:32 +0000
commit283c8caccd093f8e1d4f0bdd01ac240b4edbd20a (patch)
treebf56193b8f9bd39bcb2ffd3251e27f67d7953a2e /lib/Transforms/InstCombine/InstCombineCasts.cpp
parent2b9bc422a5e6840f5b925316bc06d5943deb610a (diff)
Switch ConstantVector::get to use ArrayRef instead of a pointer+size
idiom. Change various clients to simplify their code. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125487 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineCasts.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineCasts.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineCasts.cpp b/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 1ffcc2b122..b432641a14 100644
--- a/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1037,11 +1037,8 @@ Instruction *InstCombiner::visitSExt(SExtInst &CI) {
if (Pred == ICmpInst::ICMP_SLT && CmpLHS->getType() == DestTy) {
const Type *EltTy = VTy->getElementType();
- // splat the shift constant to a cosntant vector
- Constant *Sh = ConstantInt::get(EltTy, EltTy->getScalarSizeInBits()-1);
- std::vector<Constant *> Elts(VTy->getNumElements(), Sh);
- Constant *VSh = ConstantVector::get(Elts);
-
+ // splat the shift constant to a constant vector.
+ Constant *VSh = ConstantInt::get(VTy, EltTy->getScalarSizeInBits()-1);
Value *In = Builder->CreateAShr(CmpLHS, VSh,CmpLHS->getName()+".lobit");
return ReplaceInstUsesWith(CI, In);
}
@@ -1390,8 +1387,7 @@ static Instruction *OptimizeVectorResize(Value *InVal, const VectorType *DestTy,
ConstantInt::get(Int32Ty, SrcElts));
}
- Constant *Mask = ConstantVector::get(ShuffleMask.data(), ShuffleMask.size());
- return new ShuffleVectorInst(InVal, V2, Mask);
+ return new ShuffleVectorInst(InVal, V2, ConstantVector::get(ShuffleMask));
}
static bool isMultipleOfTypeSize(unsigned Value, const Type *Ty) {