[llvm] [Vectorize] Remove unused functions (NFC) (PR #226392)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 00:53:31 PDT 2026
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/226392
BoUpSLP::TreeEntry::isOneOf:
The last caller was removed on April 1, 2025 in commit
0e3049c562ccdea288c3b1f3b3d1ce5992d284b0.
BoUpSLP::ScheduleCopyableData::verify:
Introduced on August 11, 2025 in commit
2d7b55a028139dde58a994a65895841190dfde96 without any callers.
HorizontalReduction::hasSameParent:
The last caller was removed on July 29, 2024 in commit
197f4a90519df308d9bfddcc931f7683a5ae9cb9.
VPBlockBase::getHierarchicalPredecessors:
The last caller was removed on May 24, 2025 in commit
dcef154b5caf6556e69bb18bbb0506d274aa474e.
VPIRFlags::isNonNeg:
The last caller was removed on July 1, 2025 in commit
6b3d2b629cc3805d483ec4522cc97e2540070ae1.
VPHistogramRecipe::getOpcode:
Introduced on September 27, 2024 in commit
6f1a8c2da278a04565877e277bc4d5b70055ac74 without any callers.
VPWidenInductionRecipe::setStepValue:
The last caller was removed on May 22, 2026 in commit
5c853423f4f9e7296b7596b7f3ccade481686bfd.
VPReductionPHIRecipe::isPartialReduction:
Introduced on November 26, 2025 in commit
071d1fb8beda4c0ec9ede0acab12a382f34758fe without any callers.
VPTransformState::reset:
The last callers were removed on May 3, 2026 in commit
efd429fdfb6f3f0a6991d9d08ab15ca89f27a7c3.
m_SpecificSInt:
The last caller was removed on February 23, 2026 in commit
4bd0e49f8a61b1992a2be724a9d24844b0aec411.
m_VPInstruction(VPInstruction *&):
The last caller was removed on September 9, 2025 in commit
c4b17bf9ed46acbd8b28987f2a6262964e4e2072.
m_FAdd:
The last caller was removed on March 20, 2026 in commit
4b17135d14aaaf2bbfb1878ecad6b551081eac43.
m_LogicalOr:
The last caller was removed on February 12, 2026 in commit
2223b931c5c350cdac38e377f166d69760a15676.
m_ReductionPhi:
The last caller was removed on February 10, 2026 in commit
3157758190a487e344ecf1d2ff6402609a38d6b5.
VPValue::hasDefiningRecipe:
The last caller was removed on June 28, 2026 in commit
7abad0faf4bfe1cb674d7fd362cc31edb1d0c460.
Assisted-by: Antigravity
>From d8347079bac595f38db64a8467fbf3dc2d18eb55 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 24 Sep 2026 16:07:51 -0700
Subject: [PATCH] [Vectorize] Remove unused functions (NFC)
BoUpSLP::TreeEntry::isOneOf:
The last caller was removed on April 1, 2025 in commit
0e3049c562ccdea288c3b1f3b3d1ce5992d284b0.
BoUpSLP::ScheduleCopyableData::verify:
Introduced on August 11, 2025 in commit
2d7b55a028139dde58a994a65895841190dfde96 without any callers.
HorizontalReduction::hasSameParent:
The last caller was removed on July 29, 2024 in commit
197f4a90519df308d9bfddcc931f7683a5ae9cb9.
VPBlockBase::getHierarchicalPredecessors:
The last caller was removed on May 24, 2025 in commit
dcef154b5caf6556e69bb18bbb0506d274aa474e.
VPIRFlags::isNonNeg:
The last caller was removed on July 1, 2025 in commit
6b3d2b629cc3805d483ec4522cc97e2540070ae1.
VPHistogramRecipe::getOpcode:
Introduced on September 27, 2024 in commit
6f1a8c2da278a04565877e277bc4d5b70055ac74 without any callers.
VPWidenInductionRecipe::setStepValue:
The last caller was removed on May 22, 2026 in commit
5c853423f4f9e7296b7596b7f3ccade481686bfd.
VPReductionPHIRecipe::isPartialReduction:
Introduced on November 26, 2025 in commit
071d1fb8beda4c0ec9ede0acab12a382f34758fe without any callers.
VPTransformState::reset:
The last callers were removed on May 3, 2026 in commit
efd429fdfb6f3f0a6991d9d08ab15ca89f27a7c3.
m_SpecificSInt:
The last caller was removed on February 23, 2026 in commit
4bd0e49f8a61b1992a2be724a9d24844b0aec411.
m_VPInstruction(VPInstruction *&):
The last caller was removed on September 9, 2025 in commit
c4b17bf9ed46acbd8b28987f2a6262964e4e2072.
m_FAdd:
The last caller was removed on March 20, 2026 in commit
4b17135d14aaaf2bbfb1878ecad6b551081eac43.
m_LogicalOr:
The last caller was removed on February 12, 2026 in commit
2223b931c5c350cdac38e377f166d69760a15676.
m_ReductionPhi:
The last caller was removed on February 10, 2026 in commit
3157758190a487e344ecf1d2ff6402609a38d6b5.
VPValue::hasDefiningRecipe:
The last caller was removed on June 28, 2026 in commit
7abad0faf4bfe1cb674d7fd362cc31edb1d0c460.
Assisted-by: Antigravity
---
.../Transforms/Vectorize/SLPVectorizer.cpp | 35 -------------------
llvm/lib/Transforms/Vectorize/VPlan.h | 24 -------------
llvm/lib/Transforms/Vectorize/VPlanHelpers.h | 17 ---------
.../Transforms/Vectorize/VPlanPatternMatch.h | 28 ---------------
llvm/lib/Transforms/Vectorize/VPlanValue.h | 3 --
5 files changed, 107 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
index b76cf0677c2f6e..d823352d2ce1e2 100644
--- a/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
+++ b/llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
@@ -3040,16 +3040,6 @@ class slpvectorizer::BoUpSLP {
return S.getMatchingMainOpOrAltOp(I);
}
- /// Chooses the correct key for scheduling data. If \p Op has the same (or
- /// alternate) opcode as \p OpValue, the key is \p Op. Otherwise the key is
- /// \p OpValue.
- Value *isOneOf(Value *Op) const {
- auto *I = dyn_cast<Instruction>(Op);
- if (I && getMatchingMainOpOrAltOp(I))
- return Op;
- return S.getMainOp();
- }
-
void setOperations(const InstructionsState &S) {
assert(S && "InstructionsState is invalid.");
this->S = S;
@@ -4239,20 +4229,6 @@ class slpvectorizer::BoUpSLP {
return Entity->getKind() == Kind::ScheduleCopyableData;
}
- /// Verify basic self consistency properties
- void verify() {
- if (hasValidDependencies()) {
- assert(UnscheduledDeps <= Dependencies && "invariant");
- } else {
- assert(UnscheduledDeps == Dependencies && "invariant");
- }
-
- if (IsScheduled) {
- assert(hasValidDependencies() && UnscheduledDeps == 0 &&
- "unexpected scheduled state");
- }
- }
-
/// Returns true if the dependency information has been calculated.
/// Note that depenendency validity can vary between instructions within
/// a single bundle.
@@ -30696,17 +30672,6 @@ class HorizontalReduction {
return isCmpSelMinMax(I) ? 3 : (I->isUnaryOp() ? 1 : 2);
}
- /// Checks if the instruction is in basic block \p BB.
- /// For a cmp+sel min/max reduction check that both ops are in \p BB.
- static bool hasSameParent(Instruction *I, BasicBlock *BB) {
- if (isCmpSelMinMax(I) || isBoolLogicOp(I)) {
- auto *Sel = cast<SelectInst>(I);
- auto *Cmp = dyn_cast<Instruction>(Sel->getCondition());
- return Sel->getParent() == BB && Cmp && Cmp->getParent() == BB;
- }
- return I->getParent() == BB;
- }
-
/// Expected number of uses for reduction operations/reduced values.
static bool hasRequiredNumberOfUses(bool IsCmpSelMinMax, Instruction *I) {
if (IsCmpSelMinMax) {
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h
index 30af5f576444ea..47b5c4688e2a69 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.h
+++ b/llvm/lib/Transforms/Vectorize/VPlan.h
@@ -264,16 +264,6 @@ class LLVM_ABI_FOR_TEST VPBlockBase {
return getEnclosingBlockWithSuccessors()->getSuccessors();
}
- /// \return the predecessors either attached directly to this VPBlockBase or,
- /// if this VPBlockBase is the entry block of a VPRegionBlock and has no
- /// predecessors of its own, search recursively for the first enclosing
- /// VPRegionBlock that has predecessors and return them. If no such
- /// VPRegionBlock exists, return the (empty) predecessors of the topmost
- /// VPBlockBase reached.
- const VPBlocksTy &getHierarchicalPredecessors() {
- return getEnclosingBlockWithPredecessors()->getPredecessors();
- }
-
/// \return the hierarchical predecessor of this VPBlockBase if it has a
/// single hierarchical predecessor. Otherwise return a null pointer.
VPBlockBase *getSingleHierarchicalPredecessor() {
@@ -1014,12 +1004,6 @@ class VPIRFlags {
LLVM_ABI_FOR_TEST FastMathFlags getFastMathFlagsOrNone() const;
- bool isNonNeg() const {
- assert(OpType == OperationType::NonNegOp &&
- "recipe doesn't have a NNEG flag");
- return NonNegFlags.NonNeg;
- }
-
bool hasNoUnsignedWrap() const {
switch (OpType) {
case OperationType::OverflowingBinOp:
@@ -2198,8 +2182,6 @@ class VPHistogramRecipe : public VPRecipeBase, public VPIRMetadata {
InstructionCost computeCost(ElementCount VF,
VPCostContext &Ctx) const override;
- unsigned getOpcode() const { return Opcode; }
-
/// Return the mask operand if one was provided, or a null pointer if all
/// lanes should be executed unconditionally.
VPValue *getMask() const {
@@ -2575,9 +2557,6 @@ class VPWidenInductionRecipe : public VPHeaderPHIRecipe {
VPValue *getStepValue() { return getOperand(1); }
const VPValue *getStepValue() const { return getOperand(1); }
- /// Update the step value of the recipe.
- void setStepValue(VPValue *V) { setOperand(1, V); }
-
VPValue *getVFValue() { return getOperand(2); }
const VPValue *getVFValue() const { return getOperand(2); }
@@ -2938,9 +2917,6 @@ class VPReductionPHIRecipe : public VPHeaderPHIRecipe, public VPIRFlags {
std::holds_alternative<RdxOrdered>(Style);
}
- /// Returns true if the reduction outputs a vector with a scaled down VF.
- bool isPartialReduction() const { return getVFScaleFactor() > 1; }
-
/// Returns true, if the phi is part of a multi-use reduction.
bool hasUsesOutsideReductionChain() const {
return HasUsesOutsideReductionChain;
diff --git a/llvm/lib/Transforms/Vectorize/VPlanHelpers.h b/llvm/lib/Transforms/Vectorize/VPlanHelpers.h
index b991dd12d3e344..e20ec00a30aaac 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanHelpers.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanHelpers.h
@@ -241,12 +241,6 @@ struct VPTransformState {
Data.VPV2Vector[Def] = V;
}
- /// Reset an existing vector value for \p Def and a given \p Part.
- void reset(const VPValue *Def, Value *V) {
- assert(Data.VPV2Vector.contains(Def) && "need to overwrite existing value");
- Data.VPV2Vector[Def] = V;
- }
-
/// Set the generated scalar \p V for \p Def and the given \p Lane.
void set(const VPValue *Def, Value *V, const VPLane &Lane) {
auto &Scalars = Data.VPV2Scalars[Def];
@@ -257,17 +251,6 @@ struct VPTransformState {
Scalars[CacheIdx] = V;
}
- /// Reset an existing scalar value for \p Def and a given \p Lane.
- void reset(const VPValue *Def, Value *V, const VPLane &Lane) {
- auto Iter = Data.VPV2Scalars.find(Def);
- assert(Iter != Data.VPV2Scalars.end() &&
- "need to overwrite existing value");
- unsigned CacheIdx = Lane.mapToCacheIndex(VF);
- assert(CacheIdx < Iter->second.size() &&
- "need to overwrite existing value");
- Iter->second[CacheIdx] = V;
- }
-
/// Set the debug location in the builder using the debug location \p DL.
void setDebugLocFrom(DebugLoc DL);
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index bacffdef18fbde..d7e5c16bdb66aa 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -108,11 +108,6 @@ inline specific_intval<0> m_SpecificInt(uint64_t V) {
return specific_intval<0>(is_specific_int(APInt(64, V)));
}
-inline specific_intval<0> m_SpecificSInt(int64_t V) {
- return specific_intval<0>(
- is_specific_int(APInt(64, V, /*isSigned=*/true), /*IsSigned=*/true));
-}
-
struct is_all_ones {
bool isValue(const APInt &C) const { return C.isAllOnes(); }
};
@@ -209,11 +204,6 @@ m_VPSingleDefRecipe(VPSingleDefRecipe *&V) {
return V;
}
-/// Match a VPInstruction, capturing if we match.
-inline match_bind<VPInstruction> m_VPInstruction(VPInstruction *&V) {
- return V;
-}
-
template <typename Ops_t, unsigned Opcode, bool Commutative,
typename... RecipeTys>
struct Recipe_match {
@@ -667,12 +657,6 @@ m_FMul(const Op0_t &Op0, const Op1_t &Op1) {
return m_Binary<Instruction::FMul, Op0_t, Op1_t>(Op0, Op1);
}
-template <typename Op0_t, typename Op1_t>
-inline AllRecipe_match<Instruction::FAdd, Op0_t, Op1_t>
-m_FAdd(const Op0_t &Op0, const Op1_t &Op1) {
- return m_Binary<Instruction::FAdd, Op0_t, Op1_t>(Op0, Op1);
-}
-
template <typename Op0_t, typename Op1_t>
inline AllRecipe_commutative_match<Instruction::FAdd, Op0_t, Op1_t>
m_c_FAdd(const Op0_t &Op0, const Op1_t &Op1) {
@@ -918,13 +902,6 @@ inline auto m_c_LogicalAnd(const Op0_t &Op0, const Op1_t &Op1) {
m_c_Select(Op0, Op1, m_False()));
}
-template <typename Op0_t, typename Op1_t>
-inline auto m_LogicalOr(const Op0_t &Op0, const Op1_t &Op1) {
- return m_CombineOr(
- m_c_VPInstruction<VPInstruction::LogicalOr, Op0_t, Op1_t>(Op0, Op1),
- m_Select(Op0, m_True(), Op1));
-}
-
template <typename Op0_t, typename Op1_t>
inline auto m_c_LogicalOr(const Op0_t &Op0, const Op1_t &Op1) {
return m_c_Select(Op0, m_True(), Op1);
@@ -1190,11 +1167,6 @@ template <typename T> inline OneUse_match<T> m_OneUse(const T &SubPattern) {
return SubPattern;
}
-inline match_bind<VPReductionPHIRecipe>
-m_ReductionPhi(VPReductionPHIRecipe *&V) {
- return V;
-}
-
template <typename Op0_t, typename Op1_t>
inline auto m_VPPhi(const Op0_t &Op0, const Op1_t &Op1) {
return Recipe_match<std::tuple<Op0_t, Op1_t>, Instruction::PHI,
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index 3157d69f4f874d..efee052081c067 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -199,9 +199,6 @@ class LLVM_ABI_FOR_TEST VPValue {
/// concrete subclass.
Type *getScalarType() const;
- /// Returns true if this VPValue is defined by a recipe.
- bool hasDefiningRecipe() const { return getDefiningRecipe(); }
-
/// Returns true if the VPValue is defined outside any loop.
bool isDefinedOutsideLoopRegions() const;
More information about the llvm-commits
mailing list