Skip to content

Commit b223229

Browse files
committed
[VPlan] Re-use existing step again after 34accad.
This fixes a failing RISCV test case that was missed originally.
1 parent a22d385 commit b223229

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -503,12 +503,11 @@ void VPlanTransforms::removeDeadRecipes(VPlan &Plan) {
503503

504504
static VPValue *createScalarIVSteps(VPlan &Plan, const InductionDescriptor &ID,
505505
ScalarEvolution &SE, Instruction *TruncI,
506-
Type *IVTy, VPValue *StartV) {
506+
Type *IVTy, VPValue *StartV,
507+
VPValue *Step) {
507508
VPBasicBlock *HeaderVPBB = Plan.getVectorLoopRegion()->getEntryBasicBlock();
508509
auto IP = HeaderVPBB->getFirstNonPhi();
509510
VPCanonicalIVPHIRecipe *CanonicalIV = Plan.getCanonicalIV();
510-
VPValue *Step =
511-
vputils::getOrCreateVPValueForSCEVExpr(Plan, ID.getStep(), SE);
512511
Type *TruncTy = TruncI ? TruncI->getType() : IVTy;
513512
VPValue *BaseIV = CanonicalIV;
514513
if (!CanonicalIV->isCanonical(ID.getKind(), StartV, Step, TruncTy)) {
@@ -535,9 +534,9 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
535534
continue;
536535

537536
const InductionDescriptor &ID = WideIV->getInductionDescriptor();
538-
VPValue *Steps = createScalarIVSteps(Plan, ID, SE, WideIV->getTruncInst(),
539-
WideIV->getPHINode()->getType(),
540-
WideIV->getStartValue());
537+
VPValue *Steps = createScalarIVSteps(
538+
Plan, ID, SE, WideIV->getTruncInst(), WideIV->getPHINode()->getType(),
539+
WideIV->getStartValue(), WideIV->getStepValue());
541540

542541
// Update scalar users of IV to use Step instead. Use SetVector to ensure
543542
// the list of users doesn't contain duplicates.

0 commit comments

Comments
 (0)