[llvm] r289214 - [SelectionDAG] Add additional checks to CONCAT_VECTORS creation
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 9 06:27:53 PST 2016
Author: rksimon
Date: Fri Dec 9 08:27:52 2016
New Revision: 289214
URL: http://llvm.org/viewvc/llvm-project?rev=289214&view=rev
Log:
[SelectionDAG] Add additional checks to CONCAT_VECTORS creation
Part of the work for PR31323 - add extra asserts checking that the input vectors are of consistent type and result in the correct number of vector elements.
Modified:
llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
Modified: llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp?rev=289214&r1=289213&r2=289214&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp Fri Dec 9 08:27:52 2016
@@ -3051,6 +3051,16 @@ bool SelectionDAG::haveNoCommonBitsSet(S
static SDValue FoldCONCAT_VECTORS(const SDLoc &DL, EVT VT,
ArrayRef<SDValue> Ops,
llvm::SelectionDAG &DAG) {
+ assert(!Ops.empty() && "Can't concatenate an empty list of vectors!");
+ assert(llvm::all_of(Ops,
+ [Ops](SDValue Op) {
+ return Ops[0].getValueType() == Op.getValueType();
+ }) &&
+ "Concatenation of vectors with inconsistent value types!");
+ assert((Ops.size() * Ops[0].getValueType().getVectorNumElements()) ==
+ VT.getVectorNumElements() &&
+ "Incorrect element count in vector concatenation!");
+
if (Ops.size() == 1)
return Ops[0];
More information about the llvm-commits
mailing list