[SLP] Vectorize for all-constant entries.
[oota-llvm.git] / lib / Transforms / Vectorize / SLPVectorizer.cpp
index 149936b11b30a4abed124047a8a7ca40419cb5af..370e2956ac4fe8a36176b12059b5e8afd0f01b60 100644 (file)
@@ -1637,8 +1637,10 @@ bool BoUpSLP::isFullyVectorizableTinyTree() {
   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.