diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0fe1edad7fc0..2d6739ce085c 100644 --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -14098,8 +14098,11 @@ SDValue DAGCombiner::visitCONCAT_VECTORS(SDNode *N) { if (!SclTy.isFloatingPoint() && !SclTy.isInteger()) return SDValue(); - EVT NVT = EVT::getVectorVT(*DAG.getContext(), SclTy, - VT.getSizeInBits() / SclTy.getSizeInBits()); + unsigned VNTNumElms = VT.getSizeInBits() / SclTy.getSizeInBits(); + if (VNTNumElms < 2) + return SDValue(); + + EVT NVT = EVT::getVectorVT(*DAG.getContext(), SclTy, VNTNumElms); if (!TLI.isTypeLegal(NVT) || !TLI.isTypeLegal(Scalar.getValueType())) return SDValue(); diff --git a/llvm/test/CodeGen/Generic/pr32278.ll b/llvm/test/CodeGen/Generic/pr32278.ll index fc1f73c86ffe..175b8043126a 100644 --- a/llvm/test/CodeGen/Generic/pr32278.ll +++ b/llvm/test/CodeGen/Generic/pr32278.ll @@ -1,6 +1,4 @@ ; PR32278 -; XFAIL: * -; REQUIRES: asserts ; RUN: llc < %s