[llvm] 20b2c9f - [SLP][NFC]Use GatheredScalars vector instead of the original E->Scalars, NFC

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 08:29:47 PDT 2024


Author: Alexey Bataev
Date: 2024-08-14T08:29:38-07:00
New Revision: 20b2c9f10fe09f2c5cbd3da7f0af8df24f62e899

URL: https://github.com/llvm/llvm-project/commit/20b2c9f10fe09f2c5cbd3da7f0af8df24f62e899
DIFF: https://github.com/llvm/llvm-project/commit/20b2c9f10fe09f2c5cbd3da7f0af8df24f62e899.diff

LOG: [SLP][NFC]Use GatheredScalars vector instead of the original E->Scalars, NFC

GateredScalars is a full copy of the E->Scalars in this places and can
be safely used for now. Unifies the code across the function.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index 0550c926e5d1d..81841a8f69287 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -13096,12 +13096,12 @@ ResTy BoUpSLP::processBuildVector(const TreeEntry *E, Type *ScalarTy,
     Res = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
   } else {
     // Gather all constants.
-    SmallVector<int> Mask(E->Scalars.size(), PoisonMaskElem);
-    for (auto [I, V] : enumerate(E->Scalars)) {
+    SmallVector<int> Mask(GatheredScalars.size(), PoisonMaskElem);
+    for (auto [I, V] : enumerate(GatheredScalars)) {
       if (!isa<PoisonValue>(V))
         Mask[I] = I;
     }
-    Value *BV = ShuffleBuilder.gather(E->Scalars);
+    Value *BV = ShuffleBuilder.gather(GatheredScalars);
     ShuffleBuilder.add(BV, Mask);
     Res = ShuffleBuilder.finalize(E->ReuseShuffleIndices);
   }


        


More information about the llvm-commits mailing list