[llvm] r297878 - [DAGCombine] Bail out if can't create a vector with at least two elements

Zvi Rackover via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 12:48:37 PDT 2017


Author: zvi
Date: Wed Mar 15 14:48:36 2017
New Revision: 297878

URL: http://llvm.org/viewvc/llvm-project?rev=297878&view=rev
Log:
[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

Modified:
    llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
    llvm/trunk/test/CodeGen/Generic/pr32278.ll

Modified: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp?rev=297878&r1=297877&r2=297878&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp (original)
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp Wed Mar 15 14:48:36 2017
@@ -14098,8 +14098,11 @@ SDValue DAGCombiner::visitCONCAT_VECTORS
       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();
 

Modified: llvm/trunk/test/CodeGen/Generic/pr32278.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/Generic/pr32278.ll?rev=297878&r1=297877&r2=297878&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/Generic/pr32278.ll (original)
+++ llvm/trunk/test/CodeGen/Generic/pr32278.ll Wed Mar 15 14:48:36 2017
@@ -1,6 +1,4 @@
 ; PR32278
-; XFAIL: *
-; REQUIRES: asserts
 
 ; RUN: llc < %s
 




More information about the llvm-commits mailing list