[llvm] r240144 - [SLP] Vectorize for all-constant entries.

Michael Zolotukhin mzolotukhin at apple.com
Fri Jun 19 10:40:15 PDT 2015


Author: mzolotukhin
Date: Fri Jun 19 12:40:15 2015
New Revision: 240144

URL: http://llvm.org/viewvc/llvm-project?rev=240144&view=rev
Log:
[SLP] Vectorize for all-constant entries.

Differential Revision: http://reviews.llvm.org/D10531

Modified:
    llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
    llvm/trunk/test/Transforms/SLPVectorizer/X86/tiny-tree.ll

Modified: llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp?rev=240144&r1=240143&r2=240144&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Vectorize/SLPVectorizer.cpp Fri Jun 19 12:40:15 2015
@@ -1637,8 +1637,10 @@ bool BoUpSLP::isFullyVectorizableTinyTre
   if (VectorizableTree.size() != 2)
     return false;
 
-  // Handle splat stores.
-  if (!VectorizableTree[0].NeedToGather && isSplat(VectorizableTree[1].Scalars))
+  // Handle splat and all-constants stores.
+  if (!VectorizableTree[0].NeedToGather &&
+      (allConstant(VectorizableTree[1].Scalars) ||
+       isSplat(VectorizableTree[1].Scalars)))
     return true;
 
   // Gathering cost would be too much for tiny trees.

Modified: llvm/trunk/test/Transforms/SLPVectorizer/X86/tiny-tree.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SLPVectorizer/X86/tiny-tree.ll?rev=240144&r1=240143&r2=240144&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/SLPVectorizer/X86/tiny-tree.ll (original)
+++ llvm/trunk/test/Transforms/SLPVectorizer/X86/tiny-tree.ll Fri Jun 19 12:40:15 2015
@@ -153,3 +153,19 @@ define void @store_splat(float*, float)
   store float %1, float* %6, align 4
   ret void
 }
+
+
+; CHECK-LABEL: store_const
+; CHECK: store <4 x i32>
+define void @store_const(i32* %a) {
+entry:
+  %ptr0 = getelementptr inbounds i32, i32* %a, i64 0
+  store i32 10, i32* %ptr0, align 4
+  %ptr1 = getelementptr inbounds i32, i32* %a, i64 1
+  store i32 30, i32* %ptr1, align 4
+  %ptr2 = getelementptr inbounds i32, i32* %a, i64 2
+  store i32 20, i32* %ptr2, align 4
+  %ptr3 = getelementptr inbounds i32, i32* %a, i64 3
+  store i32 40, i32* %ptr3, align 4
+  ret void
+}





More information about the llvm-commits mailing list