From 7f04c68256951282ce8e0136371ef97410ed7db6 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 15 Oct 2022 17:58:31 +0200 Subject: Vendor import of llvm-project branch release/15.x llvmorg-15.0.1-0-gb73d2c8c720a. --- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp') diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 91bc7dbad1d0..2cdae028ec7d 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8149,9 +8149,15 @@ VPRecipeBase *VPRecipeBuilder::tryToOptimizeInductionPHI( *PSE.getSE(), *OrigLoop, Range); // Check if this is pointer induction. If so, build the recipe for it. - if (auto *II = Legal->getPointerInductionDescriptor(Phi)) - return new VPWidenPointerInductionRecipe(Phi, Operands[0], *II, - *PSE.getSE()); + if (auto *II = Legal->getPointerInductionDescriptor(Phi)) { + return new VPWidenPointerInductionRecipe( + Phi, Operands[0], *II, *PSE.getSE(), + LoopVectorizationPlanner::getDecisionAndClampRange( + [&](ElementCount VF) { + return !VF.isScalable() && CM.isScalarAfterVectorization(Phi, VF); + }, + Range)); + } return nullptr; } @@ -9332,7 +9338,7 @@ void VPWidenPointerInductionRecipe::execute(VPTransformState &State) { auto *IVR = getParent()->getPlan()->getCanonicalIV(); PHINode *CanonicalIV = cast(State.get(IVR, 0)); - if (onlyScalarsGenerated(State.VF)) { + if (onlyScalarsGenerated()) { // This is the normalized GEP that starts counting at zero. Value *PtrInd = State.Builder.CreateSExtOrTrunc( CanonicalIV, IndDesc.getStep()->getType()); -- cgit v1.3