[PATCH] D30978: [DAGCombine] Bail out if can't create a vector with at least two elements

Zvi Rackover via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 05:15:53 PDT 2017


zvi created this revision.

Fixes pr32278


Repository:
  rL LLVM

https://reviews.llvm.org/D30978

Files:
  lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  test/CodeGen/Generic/pr32278.ll


Index: test/CodeGen/Generic/pr32278.ll
===================================================================
--- test/CodeGen/Generic/pr32278.ll
+++ test/CodeGen/Generic/pr32278.ll
@@ -1,5 +1,4 @@
 ; PR32278
-; XFAIL: *
 
 ; RUN: llc < %s
 
Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -14098,8 +14098,11 @@
       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();
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30978.91859.patch
Type: text/x-patch
Size: 1005 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170315/35f5b323/attachment.bin>


More information about the llvm-commits mailing list