diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-05 20:53:47 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2016-04-05 20:53:47 +0000 |
commit | db63bda88d408743a2cb8bb7f50669c8e5f9de2c (patch) | |
tree | 1566a0598e977d41c5776041687f6af466bbaa5b /llvm/lib/IR/Constants.cpp | |
parent | 639a333730817517fba83e28620891cbe30ce642 (diff) | |
download | llvm-db63bda88d408743a2cb8bb7f50669c8e5f9de2c.zip llvm-db63bda88d408743a2cb8bb7f50669c8e5f9de2c.tar.gz llvm-db63bda88d408743a2cb8bb7f50669c8e5f9de2c.tar.bz2 |
IR: Add missing assertion for ConstantVector::ConstantVector
Use the same assertion as ConstantArray. Vectors should have the right
number of elements.
llvm-svn: 265463
Diffstat (limited to 'llvm/lib/IR/Constants.cpp')
-rw-r--r-- | llvm/lib/IR/Constants.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/IR/Constants.cpp b/llvm/lib/IR/Constants.cpp index 54d0f1f..34a3540 100644 --- a/llvm/lib/IR/Constants.cpp +++ b/llvm/lib/IR/Constants.cpp @@ -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!"); |