@@ -2390,9 +2390,8 @@ void VPlanTransforms::createInterleaveGroups(
23902390
23912391// Expand VPExtendedReductionRecipe to VPWidenCastRecipe + VPReductionRecipe.
23922392static void expandVPExtendedReduction (VPExtendedReductionRecipe *ExtRed) {
2393- // Genearte VPWidenCastRecipe.
23942393 VPWidenCastRecipe *Ext;
2395- // Only ZExt contiains non-neg flags.
2394+ // Only ZExt contains non-neg flags.
23962395 if (ExtRed->isZExt ())
23972396 Ext = new VPWidenCastRecipe (ExtRed->getExtOpcode (), ExtRed->getVecOp (),
23982397 ExtRed->getResultType (), ExtRed->isNonNeg (),
@@ -2401,7 +2400,6 @@ static void expandVPExtendedReduction(VPExtendedReductionRecipe *ExtRed) {
24012400 Ext = new VPWidenCastRecipe (ExtRed->getExtOpcode (), ExtRed->getVecOp (),
24022401 ExtRed->getResultType (), ExtRed->getDebugLoc ());
24032402
2404- // Generate VPreductionRecipe.
24052403 auto *Red = new VPReductionRecipe (
24062404 ExtRed->getRecurrenceKind (), FastMathFlags (), ExtRed->getChainOp (), Ext,
24072405 ExtRed->getCondOp (), ExtRed->isOrdered (), ExtRed->getDebugLoc ());
@@ -2450,15 +2448,13 @@ expandVPMulAccumulateReduction(VPMulAccumulateReductionRecipe *MulAcc) {
24502448 Op1 = MulAcc->getVecOp1 ();
24512449 }
24522450
2453- // Generate VPWidenRecipe.
24542451 std::array<VPValue *, 2 > MulOps = {Op0, Op1};
24552452 auto *Mul = new VPWidenRecipe (
24562453 Instruction::Mul, make_range (MulOps.begin (), MulOps.end ()),
24572454 MulAcc->hasNoUnsignedWrap (), MulAcc->hasNoSignedWrap (),
24582455 MulAcc->getDebugLoc ());
24592456 Mul->insertBefore (MulAcc);
24602457
2461- // Generate VPReductionRecipe.
24622458 auto *Red = new VPReductionRecipe (
24632459 MulAcc->getRecurrenceKind (), FastMathFlags (), MulAcc->getChainOp (), Mul,
24642460 MulAcc->getCondOp (), MulAcc->isOrdered (), MulAcc->getDebugLoc ());
@@ -2636,7 +2632,7 @@ void VPlanTransforms::handleUncountableEarlyExit(
26362632
26372633// / This function tries convert extended in-loop reductions to
26382634// / VPExtendedReductionRecipe and clamp the \p Range if it is beneficial and
2639- // / valid. The created VPExtendedReductionRecipe must be lower to concrete
2635+ // / valid. The created recipe must be lowered to concrete
26402636// / recipes before execution.
26412637static VPExtendedReductionRecipe *
26422638tryToMatchAndCreateExtendedReduction (VPReductionRecipe *Red, VPCostContext &Ctx,
@@ -2646,7 +2642,7 @@ tryToMatchAndCreateExtendedReduction(VPReductionRecipe *Red, VPCostContext &Ctx,
26462642 Type *RedTy = Ctx.Types .inferScalarType (Red);
26472643 VPValue *VecOp = Red->getVecOp ();
26482644
2649- // Test if using extended-reduction is beneficial and clamp the range.
2645+ // Test if using extended-reduction is profitable and clamp the range.
26502646 auto IsExtendedRedValidAndClampRange = [&](unsigned Opcode, bool isZExt,
26512647 Type *SrcTy) -> bool {
26522648 return LoopVectorizationPlanner::getDecisionAndClampRange (
@@ -2665,7 +2661,7 @@ tryToMatchAndCreateExtendedReduction(VPReductionRecipe *Red, VPCostContext &Ctx,
26652661 };
26662662
26672663 VPValue *A;
2668- // Matched reduce(ext)).
2664+ // Match reduce(ext)).
26692665 if (match (VecOp, m_ZExtOrSExt (m_VPValue (A))) &&
26702666 IsExtendedRedValidAndClampRange (
26712667 RecurrenceDescriptor::getOpcode (Red->getRecurrenceKind ()),
@@ -2734,7 +2730,7 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
27342730 dyn_cast_if_present<VPWidenCastRecipe>(B->getDefiningRecipe ());
27352731 auto *Mul = cast<VPWidenRecipe>(VecOp->getDefiningRecipe ());
27362732
2737- // Matched reduce.add(mul(ext, ext))
2733+ // Match reduce.add(mul(ext, ext))
27382734 if (RecipeA && RecipeB &&
27392735 (RecipeA->getOpcode () == RecipeB->getOpcode () || A == B) &&
27402736 match (RecipeA, m_ZExtOrSExt (m_VPValue ())) &&
@@ -2744,11 +2740,11 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
27442740 Mul, RecipeA, RecipeB, nullptr ))
27452741 return new VPMulAccumulateReductionRecipe (Red, Mul, RecipeA, RecipeB,
27462742 RecipeA->getResultType ());
2747- // Matched reduce.add(mul)
2743+ // Match reduce.add(mul)
27482744 if (IsMulAccValidAndClampRange (true , Mul, nullptr , nullptr , nullptr ))
27492745 return new VPMulAccumulateReductionRecipe (Red, Mul);
27502746 }
2751- // Matched reduce.add(ext(mul(ext(A), ext(B))))
2747+ // Match reduce.add(ext(mul(ext(A), ext(B))))
27522748 // All extend recipes must have same opcode or A == B
27532749 // which can be transform to reduce.add(zext(mul(sext(A), sext(B)))).
27542750 if (match (VecOp, m_ZExtOrSExt (m_Mul (m_ZExtOrSExt (m_VPValue ()),
0 commit comments