Skip to content

Commit 6d89c04

Browse files
authored
[VPlan] Remove dead AnyOf reduction case in VPReductionRecipe. NFCI (#130048)
From what I understand, we only create VPReductionRecipes for in-loop reductions, and we don't currently support in-loop AnyOf reductions. We only create VPReductionRecipes in the !PhiR->isInLoop() section of adjustRecipesForReductions, and this comment from the initial patch seems to confirm this https://reviews.llvm.org/D108136#anchor-inline-1038338, so I think we can remove this check in the condition logic. I checked compiling SPEC 2017 with -prefer-inloop-predicates and the added assertion doesn't trigger.
1 parent cc98b35 commit 6d89c04

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2222,6 +2222,8 @@ void VPReductionRecipe::execute(VPTransformState &State) {
22222222
assert(!State.Lane && "Reduction being replicated.");
22232223
Value *PrevInChain = State.get(getChainOp(), /*IsScalar*/ true);
22242224
RecurKind Kind = RdxDesc.getRecurrenceKind();
2225+
assert(!RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind) &&
2226+
"In-loop AnyOf reductions aren't currently supported");
22252227
// Propagate the fast-math flags carried by the underlying instruction.
22262228
IRBuilderBase::FastMathFlagGuard FMFGuard(State.Builder);
22272229
State.Builder.setFastMathFlags(RdxDesc.getFastMathFlags());
@@ -2232,12 +2234,8 @@ void VPReductionRecipe::execute(VPTransformState &State) {
22322234
VectorType *VecTy = dyn_cast<VectorType>(NewVecOp->getType());
22332235
Type *ElementTy = VecTy ? VecTy->getElementType() : NewVecOp->getType();
22342236

2235-
Value *Start;
2236-
if (RecurrenceDescriptor::isAnyOfRecurrenceKind(Kind))
2237-
Start = RdxDesc.getRecurrenceStartValue();
2238-
else
2239-
Start = llvm::getRecurrenceIdentity(Kind, ElementTy,
2240-
RdxDesc.getFastMathFlags());
2237+
Value *Start =
2238+
getRecurrenceIdentity(Kind, ElementTy, RdxDesc.getFastMathFlags());
22412239
if (State.VF.isVector())
22422240
Start = State.Builder.CreateVectorSplat(VecTy->getElementCount(), Start);
22432241

0 commit comments

Comments
 (0)