[llvm] [VPlan] Allow zero-operand m_VPInstruction (NFC) (PR #159550)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 03:46:08 PDT 2025
https://github.com/artagnon created https://github.com/llvm/llvm-project/pull/159550
None
>From 0184255e1fdfe33fa58292acc1b92c6b37ae2883 Mon Sep 17 00:00:00 2001
From: Ramkumar Ramachandra <ramkumar.ramachandra at codasip.com>
Date: Thu, 18 Sep 2025 11:41:09 +0100
Subject: [PATCH] [VPlan] Allow zero-operand m_VPInstruction (NFC)
---
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 8 +++-----
llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h | 6 ++----
llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp | 4 ++--
llvm/lib/Transforms/Vectorize/VPlanUtils.cpp | 3 +--
4 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 8a75fb77f91d6..696de0d15a8cf 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -6902,11 +6902,9 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
// cost model won't cost it whilst the legacy will.
if (auto *FOR = dyn_cast<VPFirstOrderRecurrencePHIRecipe>(&R)) {
using namespace VPlanPatternMatch;
- if (none_of(
- FOR->users(),
- match_fn(
- m_VPInstruction<VPInstruction::FirstOrderRecurrenceSplice>(
- m_VPValue(), m_VPValue()))))
+ if (none_of(FOR->users(),
+ match_fn(m_VPInstruction<
+ VPInstruction::FirstOrderRecurrenceSplice>())))
return true;
}
// The VPlan-based cost model is more accurate for partial reduction and
diff --git a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
index 8f9ce7a74b58b..9a7f234a1b98e 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h
@@ -239,11 +239,9 @@ struct Recipe_match {
}
bool match(const VPRecipeBase *R) const {
- if (std::tuple_size<Ops_t>::value == 0) {
- assert(Opcode == VPInstruction::BuildVector &&
- "can only match BuildVector with empty ops");
+ if (std::tuple_size_v<Ops_t> == 0) {
auto *VPI = dyn_cast<VPInstruction>(R);
- return VPI && VPI->getOpcode() == VPInstruction::BuildVector;
+ return VPI && VPI->getOpcode() == Opcode;
}
if ((!matchRecipeAndOpcode<RecipeTys>(R) && ...))
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
index 180b1b96b6364..5e7f19faebb56 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp
@@ -317,8 +317,8 @@ void UnrollState::unrollRecipeByUF(VPRecipeBase &R) {
// requiring it.
if (isa<VPScalarIVStepsRecipe, VPWidenCanonicalIVRecipe,
VPVectorPointerRecipe, VPVectorEndPointerRecipe>(Copy) ||
- match(Copy, m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
- m_VPValue())))
+ match(Copy,
+ m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>()))
Copy->addOperand(getConstantVPV(Part));
if (isa<VPVectorPointerRecipe, VPVectorEndPointerRecipe>(R))
diff --git a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
index ddc4ad1977401..f30d790a7426c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanUtils.cpp
@@ -98,8 +98,7 @@ bool vputils::isUniformAcrossVFsAndUFs(VPValue *V) {
VPRecipeBase *R = V->getDefiningRecipe();
if (R && V->isDefinedOutsideLoopRegions()) {
if (match(V->getDefiningRecipe(),
- m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
- m_VPValue())))
+ m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>()))
return false;
return all_of(R->operands(), isUniformAcrossVFsAndUFs);
}
More information about the llvm-commits
mailing list