[llvm] [SLP] NFC: Remove redundant expression from getBuildVectorCost (PR #222547)
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 10 04:25:57 PDT 2026
https://github.com/sdesmalen-arm updated https://github.com/llvm/llvm-project/pull/222547
>From d0556a4bb16fab889259fad96e766676e6b13f78 Mon Sep 17 00:00:00 2001
From: Sander de Smalen <sander.desmalen at arm.com>
Date: Wed, 9 Sep 2026 15:21:03 +0000
Subject: [PATCH] [SLP] NFC: Remove redundant expression from
getBuildVectorCost
Gathers is initialized with the contents from VL and then not modified,
so `VL.equals(Gathers)` is always true.
---
llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
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