Skip to content

Commit b32538f

Browse files
committed
!fixup, address comments.
* Fix typos. * Remove unused functions.
1 parent 26d938a commit b32538f

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2661,9 +2661,6 @@ class VPMulAccumulateReductionRecipe : public VPReductionRecipe {
26612661
/// Return if this MulAcc recipe contains extend instructions.
26622662
bool isExtended() const { return ExtOp != Instruction::CastOps::CastOpsEnd; }
26632663

2664-
/// Return if the operands of mul instruction come from same extend.
2665-
bool isSameExtend() const { return getVecOp0() == getVecOp1(); }
2666-
26672664
/// Return the opcode of the underlying extend.
26682665
Instruction::CastOps getExtOpcode() const { return ExtOp; }
26692666

@@ -3903,8 +3900,6 @@ class VPlan {
39033900
VFs.insert(VF);
39043901
}
39053902

3906-
void removeVF(ElementCount VF) { VFs.remove(VF); }
3907-
39083903
bool hasVF(ElementCount VF) const { return VFs.count(VF); }
39093904
bool hasScalableVF() const {
39103905
return any_of(VFs, [](ElementCount VF) { return VF.isScalable(); });

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2494,7 +2494,7 @@ InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
24942494
"Any-of reduction not implemented in VPlan-based cost model currently.");
24952495

24962496
// Note that TTI should model the cost of moving result to the scalar register
2497-
// and the binOp cost in the getReductionCost().
2497+
// and the BinOp cost in the getReductionCost().
24982498
if (RecurrenceDescriptor::isMinMaxRecurrenceKind(RdxKind)) {
24992499
Intrinsic::ID Id = getMinMaxReductionIntrinsicOp(RdxKind);
25002500
return Ctx.TTI.getMinMaxReductionCost(Id, VectorTy, FMFs, Ctx.CostKind);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2390,9 +2390,8 @@ void VPlanTransforms::createInterleaveGroups(
23902390

23912391
// Expand VPExtendedReductionRecipe to VPWidenCastRecipe + VPReductionRecipe.
23922392
static 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.
26412637
static VPExtendedReductionRecipe *
26422638
tryToMatchAndCreateExtendedReduction(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()),

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class PredicatedScalarEvolution;
2828
class TargetLibraryInfo;
2929
class VPBuilder;
3030
class VPRecipeBuilder;
31-
class VPCostContext;
31+
struct VPCostContext;
3232
struct VFRange;
3333

3434
extern cl::opt<bool> VerifyEachVPlan;

0 commit comments

Comments
 (0)