[llvm] 266ea44 - Revert "Recommit "[VPlan] Remove uneeded needsVectorIV check.""
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 12:33:33 PDT 2022
Author: Florian Hahn
Date: 2022-05-09T20:33:14+01:00
New Revision: 266ea446ab747671eb6c736569c3c9c5f3c53d11
URL: https://github.com/llvm/llvm-project/commit/266ea446ab747671eb6c736569c3c9c5f3c53d11
DIFF: https://github.com/llvm/llvm-project/commit/266ea446ab747671eb6c736569c3c9c5f3c53d11.diff
LOG: Revert "Recommit "[VPlan] Remove uneeded needsVectorIV check.""
This reverts commit 8b48223447311af8b3022697dd58858e1ce6975f.
This triggers an assertion on a test case mentioned in D123720.
Revert while I investigate.
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 e8f2e2f291aec..f4d2af2d9de39 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