From: Zvi Rackover Date: Wed, 15 Mar 2017 19:48:36 +0000 (+0000) Subject: [DAGCombine] Bail out if can't create a vector with at least two elements X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=184011252a453c329459ac93950499ced575943b;p=llvm [DAGCombine] Bail out if can't create a vector with at least two elements Summary: Fixes pr32278 Reviewers: igorb, craig.topper, RKSimon, spatel, hfinkel Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D30978 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@297878 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 0fe1edad7fc..2d6739ce085 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/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/test/CodeGen/Generic/pr32278.ll b/test/CodeGen/Generic/pr32278.ll index fc1f73c86ff..175b8043126 100644 --- a/test/CodeGen/Generic/pr32278.ll +++ b/test/CodeGen/Generic/pr32278.ll @@ -1,6 +1,4 @@ ; PR32278 -; XFAIL: * -; REQUIRES: asserts ; RUN: llc < %s