[PATCH] D42379: [DAGCombiner] Bail out if vector size is not a multiple

Sven van Haastregt via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 24 01:56:13 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL323312: [DAGCombiner] Bail out if vector size is not a multiple (authored by svenvh, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D42379?vs=130902&id=131208#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D42379

Files:
  llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
  llvm/trunk/test/CodeGen/AMDGPU/concat_vectors.ll


Index: llvm/trunk/test/CodeGen/AMDGPU/concat_vectors.ll
===================================================================
--- llvm/trunk/test/CodeGen/AMDGPU/concat_vectors.ll
+++ llvm/trunk/test/CodeGen/AMDGPU/concat_vectors.ll
@@ -294,3 +294,15 @@
   store <8 x float> %tmp2, <8 x float> addrspace(1)* %out, align 32
   ret void
 }
+
+; FUNC-LABEL: {{^}}concat_vector_crash2:
+; SI: s_endpgm
+define amdgpu_kernel void @concat_vector_crash2(<8 x i8> addrspace(1)* %out, i32 addrspace(1)* %in) {
+  %tmp = load i32, i32 addrspace(1)* %in, align 1
+  %tmp1 = trunc i32 %tmp to i24
+  %tmp2 = bitcast i24 %tmp1 to <3 x i8>
+  %tmp3 = shufflevector <3 x i8> %tmp2, <3 x i8> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 1, i32 undef, i32 undef>
+  %tmp4 = shufflevector <8 x i8> %tmp3, <8 x i8> <i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 undef, i8 7, i8 8>, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 14, i32 15>
+  store <8 x i8> %tmp4, <8 x i8> addrspace(1)* %out, align 8
+  ret void
+}
Index: llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
===================================================================
--- llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ llvm/trunk/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -15188,6 +15188,10 @@
       if (!SclTy.isFloatingPoint() && !SclTy.isInteger())
         return SDValue();
 
+      // Bail out if the vector size is not a multiple of the scalar size.
+      if (VT.getSizeInBits() % SclTy.getSizeInBits())
+        return SDValue();
+
       unsigned VNTNumElms = VT.getSizeInBits() / SclTy.getSizeInBits();
       if (VNTNumElms < 2)
         return SDValue();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42379.131208.patch
Type: text/x-patch
Size: 1684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180124/2bc35b42/attachment.bin>


More information about the llvm-commits mailing list