Skip to content

Commit 7cb2c1d

Browse files
committed
[VPlan] Scalable flag.
1 parent b08e892 commit 7cb2c1d

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
@@ -859,7 +859,7 @@ void VPlan::execute(VPTransformState *State) {
859859
auto *WidenPhi = cast<VPWidenPointerInductionRecipe>(&R);
860860
// TODO: Split off the case that all users of a pointer phi are scalar
861861
// from the VPWidenPointerInductionRecipe.
862-
if (WidenPhi->onlyScalarsGenerated(State->VF))
862+
if (WidenPhi->onlyScalarsGenerated(State->VF.isScalable()))
863863
continue;
864864

865865
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
@@ -1736,7 +1736,7 @@ class VPWidenPointerInductionRecipe : public VPHeaderPHIRecipe {
17361736
void execute(VPTransformState &State) override;
17371737

17381738
/// Returns true if only scalar values will be generated.
1739-
bool onlyScalarsGenerated(ElementCount VF);
1739+
bool onlyScalarsGenerated(bool Scalable);
17401740

17411741
/// Returns the induction descriptor for the recipe.
17421742
const InductionDescriptor &getInductionDescriptor() const { return IndDesc; }
@@ -2957,6 +2957,9 @@ class VPlan {
29572957
}
29582958

29592959
bool hasVF(ElementCount VF) { return VFs.count(VF); }
2960+
bool hasScalableVF() {
2961+
return any_of(VFs, [](ElementCount VF) { return VF.isScalable(); });
2962+
}
29602963

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

llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,9 +1686,9 @@ bool VPCanonicalIVPHIRecipe::isCanonical(
16861686
return StepC && StepC->isOne();
16871687
}
16881688

1689-
bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(ElementCount VF) {
1689+
bool VPWidenPointerInductionRecipe::onlyScalarsGenerated(bool Scalable) {
16901690
return IsScalarAfterVectorization &&
1691-
(!VF.isScalable() || vputils::onlyFirstLaneUsed(this));
1691+
(!Scalable || vputils::onlyFirstLaneUsed(this));
16921692
}
16931693

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

0 commit comments

Comments
 (0)