Skip to content

Commit 77e2913

Browse files
committed
[VPlan] Rename VPReverseVectorPointerRecipe to VPVectorEndPointerRecipe. NFC
After llvm#128718 lands there will be two ways of performing a reversed widened memory access, either by performing a consecutive unit-stride access and a reverse, or a strided access with a negative stride. Even though both produce a reversed vector, only the former needs VPReverseVectorPointerRecipe which computes a pointer to the last element of the widened vector. A strided reverse still needs a pointer to the first element of each part so it will use VPVectorPointerRecipe. This renames VPReverseVectorPointerRecipe to VPVectorEndPointerRecipe to clarify that a reversed access may not necessarily need a pointer to the last element.
1 parent 4f46b75 commit 77e2913

File tree

8 files changed

+26
-26
lines changed

8 files changed

+26
-26
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4506,7 +4506,7 @@ static bool willGenerateVectors(VPlan &Plan, ElementCount VF,
45064506
case VPDef::VPInstructionSC:
45074507
case VPDef::VPCanonicalIVPHISC:
45084508
case VPDef::VPVectorPointerSC:
4509-
case VPDef::VPReverseVectorPointerSC:
4509+
case VPDef::VPVectorEndPointerSC:
45104510
case VPDef::VPExpandSCEVSC:
45114511
case VPDef::VPEVLBasedIVPHISC:
45124512
case VPDef::VPPredInstPHISC:
@@ -8348,7 +8348,7 @@ VPRecipeBuilder::tryToWidenMemory(Instruction *I, ArrayRef<VPValue *> Operands,
83488348
(CM.foldTailByMasking() || !GEP || !GEP->isInBounds())
83498349
? GEPNoWrapFlags::none()
83508350
: GEPNoWrapFlags::inBounds();
8351-
VectorPtr = new VPReverseVectorPointerRecipe(
8351+
VectorPtr = new VPVectorEndPointerRecipe(
83528352
Ptr, &Plan.getVF(), getLoadStoreType(I), Flags, I->getDebugLoc());
83538353
} else {
83548354
VectorPtr = new VPVectorPointerRecipe(Ptr, getLoadStoreType(I),

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ class VPSingleDefRecipe : public VPRecipeBase, public VPValue {
516516
case VPRecipeBase::VPReplicateSC:
517517
case VPRecipeBase::VPScalarIVStepsSC:
518518
case VPRecipeBase::VPVectorPointerSC:
519-
case VPRecipeBase::VPReverseVectorPointerSC:
519+
case VPRecipeBase::VPVectorEndPointerSC:
520520
case VPRecipeBase::VPWidenCallSC:
521521
case VPRecipeBase::VPWidenCanonicalIVSC:
522522
case VPRecipeBase::VPWidenCastSC:
@@ -714,7 +714,7 @@ class VPRecipeWithIRFlags : public VPSingleDefRecipe {
714714
R->getVPDefID() == VPRecipeBase::VPWidenCastSC ||
715715
R->getVPDefID() == VPRecipeBase::VPWidenIntrinsicSC ||
716716
R->getVPDefID() == VPRecipeBase::VPReplicateSC ||
717-
R->getVPDefID() == VPRecipeBase::VPReverseVectorPointerSC ||
717+
R->getVPDefID() == VPRecipeBase::VPVectorEndPointerSC ||
718718
R->getVPDefID() == VPRecipeBase::VPVectorPointerSC;
719719
}
720720

@@ -1518,20 +1518,21 @@ class VPWidenGEPRecipe : public VPRecipeWithIRFlags {
15181518
}
15191519
};
15201520

1521-
/// A recipe to compute the pointers for widened memory accesses of IndexTy
1522-
/// in reverse order.
1523-
class VPReverseVectorPointerRecipe : public VPRecipeWithIRFlags,
1524-
public VPUnrollPartAccessor<2> {
1521+
/// A recipe to compute a pointer to the last element of each part of a widened
1522+
/// memory access for widened memory accesses of IndexedTy. Used for
1523+
/// VPWidenMemoryRecipes that are reversed.
1524+
class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
1525+
public VPUnrollPartAccessor<2> {
15251526
Type *IndexedTy;
15261527

15271528
public:
1528-
VPReverseVectorPointerRecipe(VPValue *Ptr, VPValue *VF, Type *IndexedTy,
1529-
GEPNoWrapFlags GEPFlags, DebugLoc DL)
1530-
: VPRecipeWithIRFlags(VPDef::VPReverseVectorPointerSC,
1529+
VPVectorEndPointerRecipe(VPValue *Ptr, VPValue *VF, Type *IndexedTy,
1530+
GEPNoWrapFlags GEPFlags, DebugLoc DL)
1531+
: VPRecipeWithIRFlags(VPDef::VPVectorEndPointerSC,
15311532
ArrayRef<VPValue *>({Ptr, VF}), GEPFlags, DL),
15321533
IndexedTy(IndexedTy) {}
15331534

1534-
VP_CLASSOF_IMPL(VPDef::VPReverseVectorPointerSC)
1535+
VP_CLASSOF_IMPL(VPDef::VPVectorEndPointerSC)
15351536

15361537
VPValue *getVFValue() { return getOperand(1); }
15371538
const VPValue *getVFValue() const { return getOperand(1); }
@@ -1559,10 +1560,9 @@ class VPReverseVectorPointerRecipe : public VPRecipeWithIRFlags,
15591560
return true;
15601561
}
15611562

1562-
VPReverseVectorPointerRecipe *clone() override {
1563-
return new VPReverseVectorPointerRecipe(getOperand(0), getVFValue(),
1564-
IndexedTy, getGEPNoWrapFlags(),
1565-
getDebugLoc());
1563+
VPVectorEndPointerRecipe *clone() override {
1564+
return new VPVectorEndPointerRecipe(getOperand(0), getVFValue(), IndexedTy,
1565+
getGEPNoWrapFlags(), getDebugLoc());
15661566
}
15671567

15681568
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)

llvm/lib/Transforms/Vectorize/VPlanAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ Type *VPTypeAnalysis::inferScalarType(const VPValue *V) {
248248
[](const auto *R) { return R->getScalarType(); })
249249
.Case<VPReductionRecipe, VPPredInstPHIRecipe, VPWidenPHIRecipe,
250250
VPScalarIVStepsRecipe, VPWidenGEPRecipe, VPVectorPointerRecipe,
251-
VPReverseVectorPointerRecipe, VPWidenCanonicalIVRecipe,
251+
VPVectorEndPointerRecipe, VPWidenCanonicalIVRecipe,
252252
VPPartialReductionRecipe>([this](const VPRecipeBase *R) {
253253
return inferScalarType(R->getOperand(0));
254254
})

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ bool VPRecipeBase::mayHaveSideEffects() const {
149149
case VPDerivedIVSC:
150150
case VPPredInstPHISC:
151151
case VPScalarCastSC:
152-
case VPReverseVectorPointerSC:
152+
case VPVectorEndPointerSC:
153153
return false;
154154
case VPInstructionSC:
155155
return mayWriteToMemory();
@@ -2081,7 +2081,7 @@ static Type *getGEPIndexTy(bool IsScalable, bool IsReverse,
20812081
: Builder.getInt32Ty();
20822082
}
20832083

2084-
void VPReverseVectorPointerRecipe::execute(VPTransformState &State) {
2084+
void VPVectorEndPointerRecipe::execute(VPTransformState &State) {
20852085
auto &Builder = State.Builder;
20862086
State.setDebugLocFrom(getDebugLoc());
20872087
unsigned CurrentPart = getUnrollPart(*this);
@@ -2107,8 +2107,8 @@ void VPReverseVectorPointerRecipe::execute(VPTransformState &State) {
21072107
}
21082108

21092109
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
2110-
void VPReverseVectorPointerRecipe::print(raw_ostream &O, const Twine &Indent,
2111-
VPSlotTracker &SlotTracker) const {
2110+
void VPVectorEndPointerRecipe::print(raw_ostream &O, const Twine &Indent,
2111+
VPSlotTracker &SlotTracker) const {
21122112
O << Indent;
21132113
printAsOperand(O, SlotTracker);
21142114
O << " = reverse-vector-pointer";

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,7 @@ static void transformRecipestoEVLRecipes(VPlan &Plan, VPValue &EVL) {
17581758
}
17591759

17601760
for (VPUser *U : to_vector(Plan.getVF().users())) {
1761-
if (auto *R = dyn_cast<VPReverseVectorPointerRecipe>(U))
1761+
if (auto *R = dyn_cast<VPVectorEndPointerRecipe>(U))
17621762
R->setOperand(1, &EVL);
17631763
}
17641764

llvm/lib/Transforms/Vectorize/VPlanUnroll.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,12 @@ void UnrollState::unrollRecipeByUF(VPRecipeBase &R) {
311311
// Add operand indicating the part to generate code for, to recipes still
312312
// requiring it.
313313
if (isa<VPScalarIVStepsRecipe, VPWidenCanonicalIVRecipe,
314-
VPVectorPointerRecipe, VPReverseVectorPointerRecipe>(Copy) ||
314+
VPVectorPointerRecipe, VPVectorEndPointerRecipe>(Copy) ||
315315
match(Copy, m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
316316
m_VPValue())))
317317
Copy->addOperand(getConstantVPV(Part));
318318

319-
if (isa<VPVectorPointerRecipe, VPReverseVectorPointerRecipe>(R))
319+
if (isa<VPVectorPointerRecipe, VPVectorEndPointerRecipe>(R))
320320
Copy->setOperand(0, R.getOperand(0));
321321
}
322322
}

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class VPDef {
335335
VPScalarCastSC,
336336
VPScalarIVStepsSC,
337337
VPVectorPointerSC,
338-
VPReverseVectorPointerSC,
338+
VPVectorEndPointerSC,
339339
VPWidenCallSC,
340340
VPWidenCanonicalIVSC,
341341
VPWidenCastSC,

llvm/lib/Transforms/Vectorize/VPlanVerifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bool VPlanVerifier::verifyEVLRecipe(const VPInstruction &EVL) const {
143143
})
144144
.Case<VPWidenStoreEVLRecipe, VPReductionEVLRecipe>(
145145
[&](const VPRecipeBase *S) { return VerifyEVLUse(*S, 2); })
146-
.Case<VPWidenLoadEVLRecipe, VPReverseVectorPointerRecipe,
146+
.Case<VPWidenLoadEVLRecipe, VPVectorEndPointerRecipe,
147147
VPScalarPHIRecipe>(
148148
[&](const VPRecipeBase *R) { return VerifyEVLUse(*R, 1); })
149149
.Case<VPScalarCastRecipe>(

0 commit comments

Comments
 (0)