Skip to content

Commit

Permalink
Manually implement classof of VPReductionRecipe.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mel-Chen committed Jul 8, 2024
1 parent 2a9352b commit bdafefa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion llvm/lib/Transforms/Vectorize/VPlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,15 @@ class VPReductionRecipe : public VPSingleDefRecipe {
getVecOp(), getCondOp(), IsOrdered);
}

VP_CLASSOF_IMPL(VPDef::VPReductionSC)
static inline bool classof(const VPRecipeBase *R) {
return R->getVPDefID() == VPRecipeBase::VPReductionSC ||
R->getVPDefID() == VPRecipeBase::VPReductionEVLSC;
}

static inline bool classof(const VPUser *U) {
auto *R = dyn_cast<VPRecipeBase>(U);
return R && classof(R);
}

/// Generate the reduction in the loop
void execute(VPTransformState &State) override;
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
.Case<VPExpandSCEVRecipe>([](const VPExpandSCEVRecipe *R) {
return R->getSCEV()->getType();
})
.Case<VPReductionRecipe, VPReductionEVLRecipe>([this](const auto *R) {
.Case<VPReductionRecipe>([this](const auto *R) {
return inferScalarType(R->getChainOp());
});

Expand Down

0 comments on commit bdafefa

Please sign in to comment.