Skip to content

Commit f68f3b9

Browse files
authored
[VPlan] Allow zero-operand m_VPInstruction (NFC) (#159550)
1 parent e6c27b3 commit f68f3b9

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6902,11 +6902,9 @@ static bool planContainsAdditionalSimplifications(VPlan &Plan,
69026902
// cost model won't cost it whilst the legacy will.
69036903
if (auto *FOR = dyn_cast<VPFirstOrderRecurrencePHIRecipe>(&R)) {
69046904
using namespace VPlanPatternMatch;
6905-
if (none_of(
6906-
FOR->users(),
6907-
match_fn(
6908-
m_VPInstruction<VPInstruction::FirstOrderRecurrenceSplice>(
6909-
m_VPValue(), m_VPValue()))))
6905+
if (none_of(FOR->users(),
6906+
match_fn(m_VPInstruction<
6907+
VPInstruction::FirstOrderRecurrenceSplice>())))
69106908
return true;
69116909
}
69126910
// The VPlan-based cost model is more accurate for partial reduction and

llvm/lib/Transforms/Vectorize/VPlanPatternMatch.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,11 +239,9 @@ struct Recipe_match {
239239
}
240240

241241
bool match(const VPRecipeBase *R) const {
242-
if (std::tuple_size<Ops_t>::value == 0) {
243-
assert(Opcode == VPInstruction::BuildVector &&
244-
"can only match BuildVector with empty ops");
242+
if (std::tuple_size_v<Ops_t> == 0) {
245243
auto *VPI = dyn_cast<VPInstruction>(R);
246-
return VPI && VPI->getOpcode() == VPInstruction::BuildVector;
244+
return VPI && VPI->getOpcode() == Opcode;
247245
}
248246

249247
if ((!matchRecipeAndOpcode<RecipeTys>(R) && ...))

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,8 @@ void UnrollState::unrollRecipeByUF(VPRecipeBase &R) {
317317
// requiring it.
318318
if (isa<VPScalarIVStepsRecipe, VPWidenCanonicalIVRecipe,
319319
VPVectorPointerRecipe, VPVectorEndPointerRecipe>(Copy) ||
320-
match(Copy, m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
321-
m_VPValue())))
320+
match(Copy,
321+
m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>()))
322322
Copy->addOperand(getConstantVPV(Part));
323323

324324
if (isa<VPVectorPointerRecipe, VPVectorEndPointerRecipe>(R))

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,7 @@ bool vputils::isUniformAcrossVFsAndUFs(VPValue *V) {
9898
VPRecipeBase *R = V->getDefiningRecipe();
9999
if (R && V->isDefinedOutsideLoopRegions()) {
100100
if (match(V->getDefiningRecipe(),
101-
m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
102-
m_VPValue())))
101+
m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>()))
103102
return false;
104103
return all_of(R->operands(), isUniformAcrossVFsAndUFs);
105104
}

0 commit comments

Comments
 (0)