diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-15 00:14:00 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-15 00:14:00 +0000 |
commit | 2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b (patch) | |
tree | 6f1f14dd87926e65a6beff9e41fb051e116d7f1c /lib/Transforms | |
parent | 04df049014396fe97a31bf3fa8951201b2ed8ffe (diff) | |
download | llvm-2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b.tar.gz llvm-2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b.tar.bz2 llvm-2ca5c8644e6c35b3a7910a576ed89cddb7b82c3b.tar.xz |
convert ConstantVector::get to use ArrayRef.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/GlobalOpt.cpp | 3 | ||||
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineCasts.cpp | 10 | ||||
-rw-r--r-- | lib/Transforms/Scalar/ScalarReplAggregates.cpp | 2 |
3 files changed, 5 insertions, 10 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp index 37ccc04d14..d4cb71272f 100644 --- a/lib/Transforms/IPO/GlobalOpt.cpp +++ b/lib/Transforms/IPO/GlobalOpt.cpp @@ -2257,8 +2257,7 @@ static Constant *EvaluateStoreInto(Constant *Init, Constant *Val, if (Init->getType()->isArrayTy()) return ConstantArray::get(cast<ArrayType>(InitTy), Elts); - else - return ConstantVector::get(&Elts[0], Elts.size()); + return ConstantVector::get(Elts); } } 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) { diff --git a/lib/Transforms/Scalar/ScalarReplAggregates.cpp b/lib/Transforms/Scalar/ScalarReplAggregates.cpp index f847e358d1..c3ca85280e 100644 --- a/lib/Transforms/Scalar/ScalarReplAggregates.cpp +++ b/lib/Transforms/Scalar/ScalarReplAggregates.cpp @@ -1916,7 +1916,7 @@ void SROA::RewriteMemIntrinUserOfAlloca(MemIntrinsic *MI, Instruction *Inst, if (EltTy != ValTy) { unsigned NumElts = cast<VectorType>(ValTy)->getNumElements(); SmallVector<Constant*, 16> Elts(NumElts, StoreVal); - StoreVal = ConstantVector::get(&Elts[0], NumElts); + StoreVal = ConstantVector::get(Elts); } } new StoreInst(StoreVal, EltPtr, MI); |