Skip to content

Commit 1d717d2

Browse files
committed
!fixup adjust naming
1 parent 285ac34 commit 1d717d2

File tree

3 files changed

+49
-46
lines changed

3 files changed

+49
-46
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2713,9 +2713,9 @@ class VPBranchOnMaskRecipe : public VPRecipeBase {
27132713
/// graph of other, non-bundled recipes. Def-use edges between pairs of bundled
27142714
/// recipes remain intact, whereas every edge between a bundled and a
27152715
/// non-bundled recipe is elevated to connect the non-bundled recipe with the
2716-
/// VPExpression itself.
2717-
class VPExpression : public VPSingleDefRecipe {
2718-
/// Recipes bundled together in this VPExpression.
2716+
/// VPSingleDefBundleRecipe itself.
2717+
class VPSingleDefBundleRecipe : public VPSingleDefRecipe {
2718+
/// Recipes bundled together in this VPSingleDefBundleRecipe.
27192719
SmallVector<VPSingleDefRecipe *> BundledRecipes;
27202720

27212721
/// Temporary VPValues used for external operands of the bundle, i.e. operands
@@ -2740,25 +2740,27 @@ class VPExpression : public VPSingleDefRecipe {
27402740
/// Type of the bundle.
27412741
BundleTypes BundleType;
27422742

2743-
/// Construct a new VPExpression by internalizing recipes in \p
2743+
/// Construct a new VPSingleDefBundleRecipe by internalizing recipes in \p
27442744
/// BundledRecipes. External operands (i.e. not defined by another recipe in
27452745
/// the bundle) are replaced by temporary VPValues and the original operands
2746-
/// are transferred to the VPExpression itself. Clone recipes as needed
2747-
/// (excluding last) to ensure they are only used by other recipes in the
2748-
/// bundle.
2749-
VPExpression(BundleTypes BundleType, ArrayRef<VPSingleDefRecipe *> ToBundle);
2746+
/// are transferred to the VPSingleDefBundleRecipe itself. Clone recipes as
2747+
/// needed (excluding last) to ensure they are only used by other recipes in
2748+
/// the bundle.
2749+
VPSingleDefBundleRecipe(BundleTypes BundleType,
2750+
ArrayRef<VPSingleDefRecipe *> ToBundle);
27502751

27512752
public:
2752-
VPExpression(VPWidenCastRecipe *Ext, VPReductionRecipe *Red)
2753-
: VPExpression(BundleTypes::ExtendedReduction, {Ext, Red}) {}
2754-
VPExpression(VPWidenRecipe *Mul, VPReductionRecipe *Red)
2755-
: VPExpression(BundleTypes::MulAccumulateReduction, {Mul, Red}) {}
2756-
VPExpression(VPWidenCastRecipe *Ext0, VPWidenCastRecipe *Ext1,
2757-
VPWidenRecipe *Mul, VPReductionRecipe *Red)
2758-
: VPExpression(BundleTypes::ExtMulAccumulateReduction,
2759-
{Ext0, Ext1, Mul, Red}) {}
2760-
2761-
~VPExpression() override {
2753+
VPSingleDefBundleRecipe(VPWidenCastRecipe *Ext, VPReductionRecipe *Red)
2754+
: VPSingleDefBundleRecipe(BundleTypes::ExtendedReduction, {Ext, Red}) {}
2755+
VPSingleDefBundleRecipe(VPWidenRecipe *Mul, VPReductionRecipe *Red)
2756+
: VPSingleDefBundleRecipe(BundleTypes::MulAccumulateReduction,
2757+
{Mul, Red}) {}
2758+
VPSingleDefBundleRecipe(VPWidenCastRecipe *Ext0, VPWidenCastRecipe *Ext1,
2759+
VPWidenRecipe *Mul, VPReductionRecipe *Red)
2760+
: VPSingleDefBundleRecipe(BundleTypes::ExtMulAccumulateReduction,
2761+
{Ext0, Ext1, Mul, Red}) {}
2762+
2763+
~VPSingleDefBundleRecipe() override {
27622764
SmallPtrSet<VPRecipeBase *, 4> Seen;
27632765
for (auto *R : reverse(BundledRecipes))
27642766
if (Seen.insert(R).second)
@@ -2769,7 +2771,7 @@ class VPExpression : public VPSingleDefRecipe {
27692771

27702772
VP_CLASSOF_IMPL(VPDef::VPBundleSC)
27712773

2772-
VPExpression *clone() override {
2774+
VPSingleDefBundleRecipe *clone() override {
27732775
assert(!BundledRecipes.empty() && "empty bundles should be removed");
27742776
SmallVector<VPSingleDefRecipe *> NewBundledRecipes;
27752777
for (auto *R : BundledRecipes)
@@ -2783,7 +2785,7 @@ class VPExpression : public VPSingleDefRecipe {
27832785
zip(BundleLiveInPlaceholders, operands()))
27842786
New->replaceUsesOfWith(Placeholder, OutsideOp);
27852787
}
2786-
return new VPExpression(BundleType, NewBundledRecipes);
2788+
return new VPSingleDefBundleRecipe(BundleType, NewBundledRecipes);
27872789
}
27882790

27892791
/// Return the VPSingleDefRecipe producing the final result of the bundled

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using VectorParts = SmallVector<Value *, 2>;
5050
bool VPRecipeBase::mayWriteToMemory() const {
5151
switch (getVPDefID()) {
5252
case VPBundleSC:
53-
return cast<VPBundleRecipe>(this)->mayReadOrWriteMemory();
53+
return cast<VPSingleDefBundleRecipe>(this)->mayReadOrWriteMemory();
5454
case VPInstructionSC:
5555
return cast<VPInstruction>(this)->opcodeMayReadOrWriteFromMemory();
5656
case VPInterleaveSC:
@@ -100,7 +100,7 @@ bool VPRecipeBase::mayWriteToMemory() const {
100100
bool VPRecipeBase::mayReadFromMemory() const {
101101
switch (getVPDefID()) {
102102
case VPBundleSC:
103-
return cast<VPBundleRecipe>(this)->mayReadOrWriteMemory();
103+
return cast<VPSingleDefBundleRecipe>(this)->mayReadOrWriteMemory();
104104
case VPInstructionSC:
105105
return cast<VPInstruction>(this)->opcodeMayReadOrWriteFromMemory();
106106
case VPWidenLoadEVLSC:
@@ -148,7 +148,7 @@ bool VPRecipeBase::mayReadFromMemory() const {
148148
bool VPRecipeBase::mayHaveSideEffects() const {
149149
switch (getVPDefID()) {
150150
case VPBundleSC:
151-
return cast<VPBundleRecipe>(this)->mayHaveSideEffects();
151+
return cast<VPSingleDefBundleRecipe>(this)->mayHaveSideEffects();
152152
case VPDerivedIVSC:
153153
case VPFirstOrderRecurrencePHISC:
154154
case VPPredInstPHISC:
@@ -2506,8 +2506,8 @@ InstructionCost VPReductionRecipe::computeCost(ElementCount VF,
25062506
Ctx.CostKind);
25072507
}
25082508

2509-
VPBundleRecipe::VPBundleRecipe(BundleTypes BundleType,
2510-
ArrayRef<VPSingleDefRecipe *> ToBundle)
2509+
VPSingleDefBundleRecipe::VPSingleDefBundleRecipe(
2510+
BundleTypes BundleType, ArrayRef<VPSingleDefRecipe *> ToBundle)
25112511
: VPSingleDefRecipe(VPDef::VPBundleSC, {}, {}),
25122512
BundledRecipes(
25132513
SetVector<VPSingleDefRecipe *>(ToBundle.begin(), ToBundle.end())
@@ -2544,7 +2544,7 @@ VPBundleRecipe::VPBundleRecipe(BundleTypes BundleType,
25442544
// Internalize all external operands to the bundled recipes. To do so,
25452545
// create new temporary VPValues for all operands defined by a recipe outside
25462546
// the bundle. The original operands are added as operands of the
2547-
// VPBundleRecipe itself.
2547+
// VPSingleDefBundleRecipe itself.
25482548
for (auto *R : BundledRecipes) {
25492549
for (const auto &[Idx, Op] : enumerate(R->operands())) {
25502550
auto *Def = Op->getDefiningRecipe();
@@ -2557,7 +2557,7 @@ VPBundleRecipe::VPBundleRecipe(BundleTypes BundleType,
25572557
}
25582558
}
25592559

2560-
void VPBundleRecipe::unbundle() {
2560+
void VPSingleDefBundleRecipe::unbundle() {
25612561
for (auto *R : BundledRecipes)
25622562
R->insertBefore(this);
25632563

@@ -2568,13 +2568,13 @@ void VPBundleRecipe::unbundle() {
25682568
BundledRecipes.clear();
25692569
}
25702570

2571-
InstructionCost VPBundleRecipe::computeCost(ElementCount VF,
2572-
VPCostContext &Ctx) const {
2571+
InstructionCost VPSingleDefBundleRecipe::computeCost(ElementCount VF,
2572+
VPCostContext &Ctx) const {
25732573
Type *RedTy = Ctx.Types.inferScalarType(this);
25742574
auto *SrcVecTy = cast<VectorType>(
25752575
toVectorTy(Ctx.Types.inferScalarType(getOperand(0)), VF));
25762576
assert(RedTy->isIntegerTy() &&
2577-
"VPBundleRecipe only supports integer types currently.");
2577+
"VPSingleDefBundleRecipe only supports integer types currently.");
25782578
switch (BundleType) {
25792579
case BundleTypes::ExtendedReduction: {
25802580
unsigned Opcode = RecurrenceDescriptor::getOpcode(
@@ -2596,21 +2596,21 @@ InstructionCost VPBundleRecipe::computeCost(ElementCount VF,
25962596
}
25972597
}
25982598

2599-
bool VPBundleRecipe::mayReadOrWriteMemory() const {
2599+
bool VPSingleDefBundleRecipe::mayReadOrWriteMemory() const {
26002600
return any_of(BundledRecipes, [](VPSingleDefRecipe *R) {
26012601
return R->mayReadFromMemory() || R->mayWriteToMemory();
26022602
});
26032603
}
26042604

2605-
bool VPBundleRecipe::mayHaveSideEffects() const {
2605+
bool VPSingleDefBundleRecipe::mayHaveSideEffects() const {
26062606
return any_of(BundledRecipes,
26072607
[](VPSingleDefRecipe *R) { return R->mayHaveSideEffects(); });
26082608
}
26092609

26102610
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
26112611

2612-
void VPBundleRecipe::print(raw_ostream &O, const Twine &Indent,
2613-
VPSlotTracker &SlotTracker) const {
2612+
void VPSingleDefBundleRecipe::print(raw_ostream &O, const Twine &Indent,
2613+
VPSlotTracker &SlotTracker) const {
26142614
O << Indent << "BUNDLE ";
26152615
printAsOperand(O, SlotTracker);
26162616
O << " = ";

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,7 +2710,7 @@ void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan,
27102710
ToRemove.push_back(VPI);
27112711
}
27122712
for (VPRecipeBase &R : make_early_inc_range(*VPBB)) {
2713-
if (auto *Bundle = dyn_cast<VPBundleRecipe>(&R)) {
2713+
if (auto *Bundle = dyn_cast<VPSingleDefBundleRecipe>(&R)) {
27142714
Bundle->unbundle();
27152715
Bundle->eraseFromParent();
27162716
}
@@ -2813,10 +2813,10 @@ void VPlanTransforms::handleUncountableEarlyExit(
28132813
}
28142814

28152815
/// This function tries convert extended in-loop reductions to
2816-
/// VPBundleRecipe and clamp the \p Range if it is beneficial and
2816+
/// VPSingleDefBundleRecipe and clamp the \p Range if it is beneficial and
28172817
/// valid. The created recipe must be unbundled to its constituent
28182818
/// recipes before execution.
2819-
static VPBundleRecipe *
2819+
static VPSingleDefBundleRecipe *
28202820
tryToMatchAndCreateExtendedReduction(VPReductionRecipe *Red, VPCostContext &Ctx,
28212821
VFRange &Range) {
28222822
using namespace VPlanPatternMatch;
@@ -2850,19 +2850,20 @@ tryToMatchAndCreateExtendedReduction(VPReductionRecipe *Red, VPCostContext &Ctx,
28502850
cast<VPWidenCastRecipe>(VecOp)->getOpcode() ==
28512851
Instruction::CastOps::ZExt,
28522852
Ctx.Types.inferScalarType(A)))
2853-
return new VPBundleRecipe(cast<VPWidenCastRecipe>(VecOp), Red);
2853+
return new VPSingleDefBundleRecipe(cast<VPWidenCastRecipe>(VecOp), Red);
28542854

28552855
return nullptr;
28562856
}
28572857

28582858
/// This function tries convert extended in-loop reductions to
2859-
/// VPBundleRecipe and clamp the \p Range if it is beneficial
2860-
/// and valid. The created VPBundleRecipe must be unbundled to its constituent
2861-
/// recipes before execution. Patterns of the VPBundleRecipe:
2859+
/// VPSingleDefBundleRecipe and clamp the \p Range if it is beneficial
2860+
/// and valid. The created VPSingleDefBundleRecipe must be unbundled to its
2861+
/// constituent recipes before execution. Patterns of the
2862+
/// VPSingleDefBundleRecipe:
28622863
/// reduce.add(mul(...)),
28632864
/// reduce.add(mul(ext(A), ext(B))),
28642865
/// reduce.add(ext(mul(ext(A), ext(B)))).
2865-
static VPBundleRecipe *
2866+
static VPSingleDefBundleRecipe *
28662867
tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
28672868
VPCostContext &Ctx, VFRange &Range) {
28682869
using namespace VPlanPatternMatch;
@@ -2919,11 +2920,11 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
29192920
IsMulAccValidAndClampRange(RecipeA->getOpcode() ==
29202921
Instruction::CastOps::ZExt,
29212922
Mul, RecipeA, RecipeB, nullptr)) {
2922-
return new VPBundleRecipe(RecipeA, RecipeB, Mul, Red);
2923+
return new VPSingleDefBundleRecipe(RecipeA, RecipeB, Mul, Red);
29232924
}
29242925
// Match reduce.add(mul).
29252926
if (IsMulAccValidAndClampRange(true, Mul, nullptr, nullptr, nullptr)) {
2926-
return new VPBundleRecipe(Mul, Red);
2927+
return new VPSingleDefBundleRecipe(Mul, Red);
29272928
}
29282929
}
29292930
// Match reduce.add(ext(mul(ext(A), ext(B)))).
@@ -2957,7 +2958,7 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
29572958
Mul->setOperand(0, NewExt0);
29582959
Mul->setOperand(1, NewExt1);
29592960
Red->setOperand(1, Mul);
2960-
return new VPBundleRecipe(NewExt0, NewExt1, Mul, Red);
2961+
return new VPSingleDefBundleRecipe(NewExt0, NewExt1, Mul, Red);
29612962
}
29622963
}
29632964
return nullptr;
@@ -2968,7 +2969,7 @@ tryToMatchAndCreateMulAccumulateReduction(VPReductionRecipe *Red,
29682969
static void tryToCreateAbstractReductionRecipe(VPReductionRecipe *Red,
29692970
VPCostContext &Ctx,
29702971
VFRange &Range) {
2971-
VPBundleRecipe *AbstractR = nullptr;
2972+
VPSingleDefBundleRecipe *AbstractR = nullptr;
29722973
auto IP = std::next(Red->getIterator());
29732974
auto *VPBB = Red->getParent();
29742975
if (auto *MulAcc = tryToMatchAndCreateMulAccumulateReduction(Red, Ctx, Range))

0 commit comments

Comments
 (0)