Skip to content

Commit 6993d3c

Browse files
committed
nfc, isFull for group
1 parent 3e42146 commit 6993d3c

File tree

4 files changed

+10
-11
lines changed

4 files changed

+10
-11
lines changed

llvm/include/llvm/Analysis/VectorUtils.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,9 @@ template <typename InstTy> class InterleaveGroup {
633633
return true;
634634
}
635635

636+
/// Return true if the group has no gaps.
637+
bool isFull() const { return getNumMembers() == getFactor(); }
638+
636639
private:
637640
uint32_t Factor; // Interleave Factor.
638641
bool Reverse;

llvm/lib/Analysis/VectorUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,7 +1117,7 @@ Constant *
11171117
llvm::createBitMaskForGaps(IRBuilderBase &Builder, unsigned VF,
11181118
const InterleaveGroup<Instruction> &Group) {
11191119
// All 1's means mask is not needed.
1120-
if (Group.getNumMembers() == Group.getFactor())
1120+
if (Group.isFull())
11211121
return nullptr;
11221122

11231123
// TODO: support reversed access.
@@ -1663,7 +1663,7 @@ void InterleavedAccessInfo::analyzeInterleaving(
16631663
// Case 1: A full group. Can Skip the checks; For full groups, if the wide
16641664
// load would wrap around the address space we would do a memory access at
16651665
// nullptr even without the transformation.
1666-
if (Group->getNumMembers() == Group->getFactor())
1666+
if (Group->isFull())
16671667
continue;
16681668

16691669
// Case 2: If first and last members of the group don't wrap this implies
@@ -1698,7 +1698,7 @@ void InterleavedAccessInfo::analyzeInterleaving(
16981698
// Case 1: A full group. Can Skip the checks; For full groups, if the wide
16991699
// store would wrap around the address space we would do a memory access at
17001700
// nullptr even without the transformation.
1701-
if (Group->getNumMembers() == Group->getFactor())
1701+
if (Group->isFull())
17021702
continue;
17031703

17041704
// Interleave-store-group with gaps is implemented using masked wide store.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3131,7 +3131,7 @@ bool LoopVectorizationCostModel::interleavedAccessCanBeWidened(
31313131
isa<LoadInst>(I) && Group->requiresScalarEpilogue() &&
31323132
!isScalarEpilogueAllowed();
31333133
bool StoreAccessWithGapsRequiresMasking =
3134-
isa<StoreInst>(I) && (Group->getNumMembers() < Group->getFactor());
3134+
isa<StoreInst>(I) && !Group->isFull();
31353135
if (!PredicatedAccessRequiresMasking &&
31363136
!LoadAccessWithGapsRequiresEpilogMasking &&
31373137
!StoreAccessWithGapsRequiresMasking)
@@ -5349,7 +5349,7 @@ LoopVectorizationCostModel::getInterleaveGroupCost(Instruction *I,
53495349
// Calculate the cost of the whole interleaved group.
53505350
bool UseMaskForGaps =
53515351
(Group->requiresScalarEpilogue() && !isScalarEpilogueAllowed()) ||
5352-
(isa<StoreInst>(I) && (Group->getNumMembers() < Group->getFactor()));
5352+
(isa<StoreInst>(I) && !Group->isFull());
53535353
InstructionCost Cost = TTI.getInterleavedMemoryOpCost(
53545354
InsertPos->getOpcode(), WideVecTy, Group->getFactor(), Indices,
53555355
Group->getAlign(), AS, CostKind, Legal->isMaskRequired(I),

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3141,9 +3141,7 @@ static bool canNarrowLoad(VPWidenRecipe *WideMember0, unsigned OpIdx,
31413141
return !W->getMask() && WideMember0->getOperand(OpIdx) == OpV;
31423142

31433143
if (auto *IR = dyn_cast<VPInterleaveRecipe>(DefR))
3144-
return IR->getInterleaveGroup()->getFactor() ==
3145-
IR->getInterleaveGroup()->getNumMembers() &&
3146-
IR->getVPValue(Idx) == OpV;
3144+
return IR->getInterleaveGroup()->isFull() && IR->getVPValue(Idx) == OpV;
31473145
return false;
31483146
}
31493147

@@ -3260,9 +3258,7 @@ void VPlanTransforms::narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
32603258
if (!DefR)
32613259
return false;
32623260
auto *IR = dyn_cast<VPInterleaveRecipe>(DefR);
3263-
return IR &&
3264-
IR->getInterleaveGroup()->getFactor() ==
3265-
IR->getInterleaveGroup()->getNumMembers() &&
3261+
return IR && IR->getInterleaveGroup()->isFull() &&
32663262
IR->getVPValue(Op.index()) == Op.value();
32673263
})) {
32683264
StoreGroups.push_back(InterleaveR);

0 commit comments

Comments
 (0)