[PATCH] D147891: [VPlan] Check VPValue step in isCanonical (NFCI).

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 16:07:27 PDT 2023


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.h:1848
   /// start, step (of 1), and type as the canonical IV.
-  bool isCanonical(const InductionDescriptor &ID, Type *Ty) const;
+  bool isCanonical(const InductionDescriptor &ID, VPValue *Step,
+                   Type *Ty) const;
----------------
Worth also passing in Start?
Documentation should be updated.


================
Comment at: llvm/lib/Transforms/Vectorize/VPlanRecipes.cpp:739
   auto *StartC = dyn_cast<ConstantInt>(getStartValue()->getLiveInIRValue());
-  auto *StepC = dyn_cast<SCEVConstant>(getInductionDescriptor().getStep());
+  if (getStepValue()->getDefiningRecipe())
+    return false;
----------------
Deserves a comment? (Step of an induction should be loop invariant, but could be defined by a recipe in loop preheader, or an invariant that was not LICM'd out? In any case, this method checks only if step is 1, i.e., live-in.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D147891/new/

https://reviews.llvm.org/D147891



More information about the llvm-commits mailing list