Skip to content

Commit 1524daf

Browse files
committed
Extract the scalar vf checking
1 parent 3ec0118 commit 1524daf

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8933,14 +8933,15 @@ void LoopVectorizationPlanner::buildVPlansWithVPRecipes(ElementCount MinVF,
89338933
for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVFTimes2);) {
89348934
VFRange SubRange = {VF, MaxVFTimes2};
89358935
if (auto Plan = tryToBuildVPlanWithVPRecipes(SubRange)) {
8936+
bool HasScalarVF = Plan->hasVF(ElementCount::getFixed(1));
89368937
// Now optimize the initial VPlan.
8937-
if (!Plan->hasVF(ElementCount::getFixed(1)))
8938+
if (!HasScalarVF)
89388939
VPlanTransforms::runPass(VPlanTransforms::truncateToMinimalBitwidths,
89398940
*Plan, CM.getMinimalBitwidths());
89408941
VPlanTransforms::optimize(*Plan);
89418942
// TODO: try to put it close to addActiveLaneMask().
89428943
// Discard the plan if it is not EVL-compatible
8943-
if (CM.foldTailWithEVL() && !Plan->hasScalarVF() &&
8944+
if (CM.foldTailWithEVL() && !HasScalarVF &&
89448945
!VPlanTransforms::runPass(VPlanTransforms::tryAddExplicitVectorLength,
89458946
*Plan, CM.getMaxSafeElements()))
89468947
break;

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3678,10 +3678,6 @@ class VPlan {
36783678
return {VFs.begin(), VFs.end()};
36793679
}
36803680

3681-
bool hasScalarVF() const {
3682-
return any_of(VFs, [](ElementCount VF) { return VF.isScalar(); });
3683-
}
3684-
36853681
bool hasScalarVFOnly() const { return VFs.size() == 1 && VFs[0].isScalar(); }
36863682

36873683
bool hasUF(unsigned UF) const { return UFs.empty() || UFs.contains(UF); }

0 commit comments

Comments
 (0)