summaryrefslogtreecommitdiffstats
path: root/llvm/lib/VMCore/Constants.cpp
diff options
context:
space:
mode:
authorJay Foad <jay.foad@gmail.com>2011-06-22 09:10:19 +0000
committerJay Foad <jay.foad@gmail.com>2011-06-22 09:10:19 +0000
commitb8a8bed30117db3f80076edc66cb032dc20d2949 (patch)
tree46109213339667c7386fc45b1b16015459b0dac7 /llvm/lib/VMCore/Constants.cpp
parent55ec2a8929205c9384848ea79338c430f4ef5bbf (diff)
downloadbcm5719-llvm-b8a8bed30117db3f80076edc66cb032dc20d2949.tar.gz
bcm5719-llvm-b8a8bed30117db3f80076edc66cb032dc20d2949.zip
Make ConstantVector::get() always take an ArrayRef, never a std::vector.
llvm-svn: 133614
Diffstat (limited to 'llvm/lib/VMCore/Constants.cpp')
-rw-r--r--llvm/lib/VMCore/Constants.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/llvm/lib/VMCore/Constants.cpp b/llvm/lib/VMCore/Constants.cpp
index 4c03288fe44..2fee173a1f7 100644
--- a/llvm/lib/VMCore/Constants.cpp
+++ b/llvm/lib/VMCore/Constants.cpp
@@ -698,9 +698,9 @@ ConstantVector::ConstantVector(const VectorType *T,
}
// ConstantVector accessors.
-Constant *ConstantVector::get(const VectorType *T,
- const std::vector<Constant*> &V) {
+Constant *ConstantVector::get(ArrayRef<Constant*> V) {
assert(!V.empty() && "Vectors can't be empty");
+ const VectorType *T = VectorType::get(V.front()->getType(), V.size());
LLVMContextImpl *pImpl = T->getContext().pImpl;
// If this is an all-undef or all-zero vector, return a
@@ -725,12 +725,6 @@ Constant *ConstantVector::get(const VectorType *T,
return pImpl->VectorConstants.getOrCreate(T, V);
}
-Constant *ConstantVector::get(ArrayRef<Constant*> V) {
- // FIXME: make this the primary ctor method.
- assert(!V.empty() && "Vectors cannot be empty");
- return get(VectorType::get(V.front()->getType(), V.size()), V.vec());
-}
-
// Utility function for determining if a ConstantExpr is a CastOp or not. This
// can't be inline because we don't want to #include Instruction.h into
// Constant.h
@@ -2118,7 +2112,7 @@ void ConstantVector::replaceUsesOfWithOnConstant(Value *From, Value *To,
Values.push_back(Val);
}
- Constant *Replacement = get(cast<VectorType>(getRawType()), Values);
+ Constant *Replacement = get(Values);
assert(Replacement != this && "I didn't contain From!");
// Everyone using this now uses the replacement.
OpenPOWER on IntegriCloud