[PATCH] D123720: [VPlan] Replace use of needsVectorIV with VPlan user check.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 13 12:59:10 PDT 2022


fhahn created this revision.
fhahn added reviewers: Ayal, gilr, rengolin.
Herald added subscribers: ctetreau, tschuett, psnobl, rogfer01, bollu, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added a subscriber: vkmr.
Herald added a project: LLVM.

Replace one of the last remaining uses of ::needsVectorIV, preparing for
its removal.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123720

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


Index: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
===================================================================
--- llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
+++ llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp
@@ -431,9 +431,11 @@
         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
+    // If there are no vector users of IV, simply update all users to use Steps
     // instead.
-    if (!IV->needsVectorIV()) {
+    if (all_of(IV->users(), [IV](VPUser *U) {
+          return cast<VPRecipeBase>(U)->usesScalars(IV);
+        })) {
       IV->replaceAllUsesWith(Steps);
       continue;
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123720.422621.patch
Type: text/x-patch
Size: 786 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220413/806a9b8f/attachment.bin>


More information about the llvm-commits mailing list