Skip to content

Commit f4e1eaa

Browse files
committed
Revert "[VPlan] Remove uneeded needsVectorIV check."
This reverts commit 43842b8 while I investigate a buildbot failure. It also reverts the follow-up commit 2883de0.
1 parent 99499c3 commit f4e1eaa

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,15 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
429429
IV->getStartValue(), Step, TruncI ? TruncI->getType() : nullptr);
430430
HeaderVPBB->insert(Steps, HeaderVPBB->getFirstNonPhi());
431431

432-
// Update scalar users of IV to use Step instead. Use SetVector to ensure
433-
// the list of users doesn't contain duplicates.
432+
// If there are no vector users of IV, simply update all users to use Step
433+
// instead.
434+
if (!IV->needsVectorIV()) {
435+
IV->replaceAllUsesWith(Steps);
436+
continue;
437+
}
438+
439+
// Otherwise only update scalar users of IV to use Step instead. Use
440+
// SetVector to ensure the list of users doesn't contain duplicates.
434441
SetVector<VPUser *> Users(IV->user_begin(), IV->user_end());
435442
for (VPUser *U : Users) {
436443
VPRecipeBase *R = cast<VPRecipeBase>(U);

0 commit comments

Comments
 (0)