[VPlan] Remove uneeded needsVectorIV check.
authorFlorian Hahn <flo@fhahn.com>
Thu, 28 Apr 2022 15:27:34 +0000 (16:27 +0100)
committerFlorian Hahn <flo@fhahn.com>
Thu, 28 Apr 2022 15:27:34 +0000 (16:27 +0100)
Remove one of the last remaining uses of ::needsVectorIV, preparing for
its removal. Now that usesScalars is available and based on the
information explicit in VPlan, there is no need to use the pre-computed
needsVectorIV.

Reviewed By: Ayal

Differential Revision: https://reviews.llvm.org/D123720

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

index f4d2af2..2c3b0ac 100644 (file)
@@ -429,15 +429,7 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
         IV->getStartValue(), Step, TruncI ? TruncI->getType() : nullptr);
     HeaderVPBB->insert(Steps, HeaderVPBB->getFirstNonPhi());
 
-    // If there are no vector users of IV, simply update all users to use Step
-    // instead.
-    if (!IV->needsVectorIV()) {
-      IV->replaceAllUsesWith(Steps);
-      continue;
-    }
-
-    // Otherwise only update scalar users of IV to use Step instead. Use
-    // SetVector to ensure the list of users doesn't contain duplicates.
+    // Update scalar users of IV to use Step instead. Use SetVector to ensure the list of users doesn't contain duplicates.
     SetVector<VPUser *> Users(IV->user_begin(), IV->user_end());
     for (VPUser *U : Users) {
       VPRecipeBase *R = cast<VPRecipeBase>(U);