[llvm] f4e1eaa - Revert "[VPlan] Remove uneeded needsVectorIV check."

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 28 12:16:37 PDT 2022


Author: Florian Hahn
Date: 2022-04-28T20:16:21+01:00
New Revision: f4e1eaa3755a13f85696be3b74b387122b74a558

URL: https://github.com/llvm/llvm-project/commit/f4e1eaa3755a13f85696be3b74b387122b74a558
DIFF: https://github.com/llvm/llvm-project/commit/f4e1eaa3755a13f85696be3b74b387122b74a558.diff

LOG: Revert "[VPlan] Remove uneeded needsVectorIV check."

This reverts commit 43842b887e0a7b918bb2d6c9f672025b2c621f8a while I
investigate a buildbot failure.

It also reverts the follow-up commit
2883de05145fc5b4afb99b91f69ebb835af36af5.

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
index e8f2e2f291ae..f4d2af2d9de3 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -429,8 +429,15 @@ void VPlanTransforms::optimizeInductions(VPlan &Plan, ScalarEvolution &SE) {
         IV->getStartValue(), Step, TruncI ? TruncI->getType() : nullptr);
     HeaderVPBB->insert(Steps, HeaderVPBB->getFirstNonPhi());
 
-    // Update scalar users of IV to use Step instead. Use SetVector to ensure
-    // the list of users doesn't contain duplicates.
+    // 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.
     SetVector<VPUser *> Users(IV->user_begin(), IV->user_end());
     for (VPUser *U : Users) {
       VPRecipeBase *R = cast<VPRecipeBase>(U);


        


More information about the llvm-commits mailing list