1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

IR: Add missing assertion for ConstantVector::ConstantVector

Use the same assertion as ConstantArray.  Vectors should have the right
number of elements.

llvm-svn: 265463
This commit is contained in:
Duncan P. N. Exon Smith 2016-04-05 20:53:47 +00:00
parent bd917fe8e6
commit f0ef586a9b

View File

@ -1036,6 +1036,8 @@ ConstantVector::ConstantVector(VectorType *T, ArrayRef<Constant *> V)
: Constant(T, ConstantVectorVal,
OperandTraits<ConstantVector>::op_end(this) - V.size(),
V.size()) {
assert(V.size() == T->getNumElements() &&
"Invalid initializer vector for constant vector");
for (size_t i = 0, e = V.size(); i != e; i++)
assert(V[i]->getType() == T->getElementType() &&
"Initializer for vector element doesn't match vector element type!");