[llvm] r265463 - IR: Add missing assertion for ConstantVector::ConstantVector
Duncan P. N. Exon Smith via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 5 13:53:50 PDT 2016
Author: dexonsmith
Date: Tue Apr 5 15:53:47 2016
New Revision: 265463
URL: http://llvm.org/viewvc/llvm-project?rev=265463&view=rev
Log:
IR: Add missing assertion for ConstantVector::ConstantVector
Use the same assertion as ConstantArray. Vectors should have the right
number of elements.
Modified:
llvm/trunk/lib/IR/Constants.cpp
Modified: llvm/trunk/lib/IR/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/Constants.cpp?rev=265463&r1=265462&r2=265463&view=diff
==============================================================================
--- llvm/trunk/lib/IR/Constants.cpp (original)
+++ llvm/trunk/lib/IR/Constants.cpp Tue Apr 5 15:53:47 2016
@@ -1036,6 +1036,8 @@ ConstantVector::ConstantVector(VectorTyp
: 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!");
More information about the llvm-commits
mailing list