[PATCH] D113223: [VPlan] Add VPCanonicalIVRecipe, partly retire createInductionVariable.

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 2 09:34:47 PST 2022


Ayal added inline comments.


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:2533
+    Value *ScalarIV = CanonicalIV;
+    if (!isCanonicalID(ID) || CanonicalIV->getType() != IV->getType()) {
       ScalarIV = IV->getType()->isIntegerTy()
----------------
Slightly more consistent to check `ScalarIV->getType() != IV->getType()`, given the cast from one to the other below.

May be good to assign `auto NeededType = IV->getType()` ?


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:8924
+
+  auto *CanonicalIV = new VPCanonicalIVPHIRecipe(StartV, DL);
+  VPRegionBlock *TopRegion = Plan.getVectorLoopRegion();
----------------
"CanonicalIV" >> "CanonicalIVPhi", to complement "CanonicalIVIncrement".


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:9674
+      IV, getInductionDescriptor(), getStartValue()->getLiveInIRValue(),
+      getTruncInst(), getVPValue(0), State, CanonicalIV);
 }
----------------
getVPValue(0) >> getVPSingleValue()?


================
Comment at: llvm/lib/Transforms/Vectorize/VPlan.cpp:972
 
+  if (VectorTripCount.getNumUsers()) {
+    O << "\nLive-in ";
----------------
VectorTripCount is always used by the compare of branch-on-count, and by it only. So its VPValue is always generated but will have a user only once the compare (possibly w/ its increment and branch) is also represented as a recipe/VPInstruction. For now can assert it has no users; code introduced otherwise is dead.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D113223



More information about the llvm-commits mailing list