[llvm] c363b39 - [SLP] NFC: Remove redundant expression from getBuildVectorCost (#222547)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 06:02:25 PDT 2026


Author: Sander de Smalen
Date: 2026-09-10T14:02:20+01:00
New Revision: c363b393529bc652c97344042a3b5e6f136d41c5

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

LOG: [SLP] NFC: Remove redundant expression from getBuildVectorCost (#222547)

Gathers is initialized with the contents from VL and then not modified,
so `VL.equals(Gathers)` is always true.

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 3fd146320c959..28e665c4c07cf 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -14451,7 +14451,6 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
       return TTI::TCC_Free;
     auto *VecTy = cast<VectorType>(getWidenedType(ScalarTy, VL.size()));
     InstructionCost GatherCost = 0;
-    SmallVector<Value *> Gathers(VL);
     if (!Root && isSplat(VL)) {
       // Found the broadcasting of the single scalar, calculate the cost as
       // the broadcast.
@@ -14486,11 +14485,9 @@ class BoUpSLP::ShuffleCostEstimator : public BaseShuffleAnalysis {
                                          /*Index=*/0, /*SubTp=*/nullptr,
                                          /*Args=*/*It);
     }
-    return GatherCost +
-           (all_of(Gathers, IsaPred<UndefValue>)
-                ? TTI::TCC_Free
-                : R.getGatherCost(Gathers, !Root && VL.equals(Gathers),
-                                  ScalarTy));
+    return GatherCost + (all_of(VL, IsaPred<UndefValue>)
+                             ? TTI::TCC_Free
+                             : R.getGatherCost(VL, !Root, ScalarTy));
   };
 
   /// Compute the cost of creating a vector containing the extracted values from


        


More information about the llvm-commits mailing list