Skip to content

Commit a3f18ae

Browse files
committed
Update comment. nfc
1 parent 736210d commit a3f18ae

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1823,6 +1823,7 @@ class LLVM_ABI_FOR_TEST VPWidenGEPRecipe : public VPRecipeWithIRFlags {
18231823
return VarIdx;
18241824
}
18251825

1826+
/// Returns the element type for the first \p I indices of this recipe.
18261827
Type *getIndexedType(unsigned I) const {
18271828
auto *GEP = cast<GetElementPtrInst>(getUnderlyingInstr());
18281829
SmallVector<Value *, 4> Ops(GEP->idx_begin(), GEP->idx_begin() + I);
@@ -1919,8 +1920,8 @@ class VPVectorEndPointerRecipe : public VPRecipeWithIRFlags,
19191920
#endif
19201921
};
19211922

1922-
/// A recipe to compute the pointers for widened memory accesses of IndexedTy,
1923-
/// with the Stride expressed in units of IndexedTy.
1923+
/// A recipe to compute the pointers for widened memory accesses of
1924+
/// SourceElementTy, with the Stride expressed in units of SourceElementTy.
19241925
class VPVectorPointerRecipe : public VPRecipeWithIRFlags,
19251926
public VPUnrollPartAccessor<2> {
19261927
Type *SourceElementTy;
@@ -3351,9 +3352,9 @@ struct VPWidenLoadEVLRecipe final : public VPWidenMemoryRecipe, public VPValue {
33513352
}
33523353
};
33533354

3354-
/// A recipe for strided load operations, using the base address, stride, and an
3355-
/// optional mask. This recipe will generate an vp.strided.load intrinsic call
3356-
/// to represent memory accesses with a fixed stride.
3355+
/// A recipe for strided load operations, using the base address, stride, VF,
3356+
/// and an optional mask. This recipe will generate a vp.strided.load intrinsic
3357+
/// call to represent memory accesses with a fixed stride.
33573358
struct VPWidenStridedLoadRecipe final : public VPWidenMemoryRecipe,
33583359
public VPValue {
33593360
VPWidenStridedLoadRecipe(LoadInst &Load, VPValue *Addr, VPValue *Stride,
@@ -3393,6 +3394,7 @@ struct VPWidenStridedLoadRecipe final : public VPWidenMemoryRecipe,
33933394
bool onlyFirstLaneUsed(const VPValue *Op) const override {
33943395
assert(is_contained(operands(), Op) &&
33953396
"Op must be an operand of the recipe");
3397+
// All operands except the mask are only used for the first lane.
33963398
return Op == getAddr() || Op == getStride() || Op == getVF();
33973399
}
33983400
};

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4513,8 +4513,8 @@ static std::pair<VPValue *, VPValue *> matchStridedStart(VPValue *CurIndex) {
45134513
if (Opcode != Instruction::Shl && Opcode != Instruction::Mul)
45144514
return {nullptr, nullptr};
45154515

4516-
// Match the pattern binop(variant, invariant), or binop(invariant, variant)
4517-
// if the binary operator is commutative.
4516+
// Match the pattern binop(variant, uniform), or binop(uniform, variant) if
4517+
// the binary operator is commutative.
45184518
bool IsLHSUniform = vputils::isSingleScalar(WidenR->getOperand(0));
45194519
if (IsLHSUniform == vputils::isSingleScalar(WidenR->getOperand(1)) ||
45204520
(IsLHSUniform && !Instruction::isCommutative(Opcode)))
@@ -4538,6 +4538,10 @@ static std::pair<VPValue *, VPValue *> matchStridedStart(VPValue *CurIndex) {
45384538
return {StartR, StrideR};
45394539
}
45404540

4541+
/// Checks if the given VPWidenGEPRecipe \p WidenGEP represents a strided
4542+
/// access. If so, it creates recipes representing the base pointer and stride
4543+
/// in element type, and returns a tuple of {base pointer, stride, element
4544+
/// type}. Otherwise, returns a tuple where all elements are nullptr.
45414545
static std::tuple<VPValue *, VPValue *, Type *>
45424546
determineBaseAndStride(VPWidenGEPRecipe *WidenGEP) {
45434547
// TODO: Check if the base pointer is strided.

0 commit comments

Comments
 (0)