Skip to content

Commit 2906f36

Browse files
committed
[VPlan] Update ::onlyScalarsGenerated to take IsScalable bool (NFCI).
Instead of passing in a full VF, just pass IsScalable as bool.
1 parent 248aeac commit 2906f36

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9237,7 +9237,7 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) {
92379237
auto *IVR = getParent()->getPlan()->getCanonicalIV();
92389238
PHINode *CanonicalIV = cast<PHINode>(State.get(IVR, 0));
92399239

9240-
if (onlyScalarsGenerated(State.VF)) {
9240+
if (onlyScalarsGenerated(State.VF.isScalable())) {
92419241
// This is the normalized GEP that starts counting at zero.
92429242
Value *PtrInd = State.Builder.CreateSExtOrTrunc(
92439243
CanonicalIV, IndDesc.getStep()->getType());

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -854,7 +854,7 @@ void VPlan::execute(VPTransformState *State) {
854854
auto *WidenPhi = cast<VPWidenPointerInductionRecipe>(&R);
855855
// TODO: Split off the case that all users of a pointer phi are scalar
856856
// from the VPWidenPointerInductionRecipe.
857-
if (WidenPhi->onlyScalarsGenerated(State->VF))
857+
if (WidenPhi->onlyScalarsGenerated(State->VF.isScalable()))
858858
continue;
859859

860860
auto *GEP = cast<GetElementPtrInst>(State->get(WidenPhi, 0));

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1745,7 +1745,7 @@ class VPWidenPointerInductionRecipe : public VPHeaderPHIRecipe {
17451745
void execute(VPTransformState &State) override;
17461746

17471747
/// Returns true if only scalar values will be generated.
1748-
bool onlyScalarsGenerated(ElementCount VF);
1748+
bool onlyScalarsGenerated(bool IsScalable);
17491749

17501750
/// Returns the induction descriptor for the recipe.
17511751
const InductionDescriptor &getInductionDescriptor() const { return IndDesc; }
@@ -2966,6 +2966,9 @@ class VPlan {
29662966
}
29672967

29682968
bool hasVF(ElementCount VF) { return VFs.count(VF); }
2969+
bool hasScalableVF() {
2970+
return any_of(VFs, [](ElementCount VF) { return VF.isScalable(); });
2971+
}
29692972

29702973
bool hasScalarVFOnly() const { return VFs.size() == 1 && VFs[0].isScalar(); }
29712974

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1650,9 +1650,9 @@ bool VPCanonicalIVPHIRecipe::isCanonical(
16501650
return StepC && StepC->isOne();
16511651
}
16521652

1653-
bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(ElementCount VF) {
1653+
bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(bool IsScalable) {
16541654
return IsScalarAfterVectorization &&
1655-
(!VF.isScalable() || vputils::onlyFirstLaneUsed(this));
1655+
(!IsScalable || vputils::onlyFirstLaneUsed(this));
16561656
}
16571657

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

0 commit comments

Comments
 (0)