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

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 15 08:05:39 PDT 2023


fhahn marked 2 inline comments as done.
fhahn 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;
----------------
Ayal wrote:
> Worth also passing in Start?
> Documentation should be updated.
Updated to pass both InductionKind & Start instead of whole induction desciptor. Comment updated accordingly, thanks!


================
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;
----------------
Ayal wrote:
> 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.)
Added a comment, thanks!


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