[llvm] [VPlan] Allow zero-operand m_VPInstruction (NFC) (PR #159550)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 18 03:46:42 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Ramkumar Ramachandra (artagnon)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/159550.diff
4 Files Affected:
- (modified) llvm/lib/Transforms/Vectorize/LoopVectorize.cpp (+3-5)
- (modified) llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h (+2-4)
- (modified) llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp (+2-2)
- (modified) llvm/lib/Transforms/Vectorize/VPlanUtils.cpp (+1-2)
``````````diff
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);
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/159550
More information about the llvm-commits
mailing list