[llvm] [SLP]Try to vectorize small graph with extractelements, used in (PR #83468)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 1 04:13:09 PST 2024


================
@@ -8974,6 +8974,20 @@ bool BoUpSLP::isTreeTinyAndNotFullyVectorizable(bool ForReduction) const {
   if (isFullyVectorizableTinyTree(ForReduction))
     return false;
 
+  // Check if any of the gather node forms an insertelement buildvector
+  // somewhere.
+  if (any_of(VectorizableTree, [](const std::unique_ptr<TreeEntry> &TE) {
+        return TE->State == TreeEntry::NeedToGather &&
+               all_of(TE->Scalars, [](Value *V) {
+                 return isa<ExtractElementInst, UndefValue>(V) ||
+                        (!V->hasNUsesOrMore(8) &&
----------------
RKSimon wrote:

Magic number?

https://github.com/llvm/llvm-project/pull/83468


More information about the llvm-commits mailing list