diff options
author | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-12-09 14:27:52 +0000 |
---|---|---|
committer | Simon Pilgrim <llvm-dev@redking.me.uk> | 2016-12-09 14:27:52 +0000 |
commit | 15f1f828b540a83744d1723a8b50a3a9fa5271be (patch) | |
tree | 893aed08433b7da8965151bc86d114cc4edf883e | |
parent | 9664921a3a726f954787d8f4ca28b80ac8e10b2b (diff) | |
download | bcm5719-llvm-15f1f828b540a83744d1723a8b50a3a9fa5271be.tar.gz bcm5719-llvm-15f1f828b540a83744d1723a8b50a3a9fa5271be.zip |
[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.
llvm-svn: 289214
-rw-r--r-- | llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index cbe5a2454ce..4656bd6e1f8 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -3051,6 +3051,16 @@ bool SelectionDAG::haveNoCommonBitsSet(SDValue A, SDValue B) const { 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]; |