[PATCH] D90342: [POC][LoopVectorizer] Propagate ElementCount to interfaces in preparation for scalable auto-vec.

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 29 13:41:40 PDT 2020


ctetreau added a comment.

This seems reasonable to me.



================
Comment at: llvm/include/llvm/Support/TypeSize.h:352
 
+  LeafTy inc(ScalarTy Amount) const {
+    return static_cast<LeafTy>(
----------------
I feel like a function called "inc" should mutate the thing being incremented. Morally, this is behaves like `operator+=`.

All uses currently of this function would be fine with these semantics with some small changes (that should probably be done anyways)


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7202-7209
+void LoopVectorizationPlanner::buildVPlans(ElementCount MinVF,
+                                           ElementCount MaxVF) {
+  for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVF.inc(1));) {
+    VFRange SubRange = {VF, MaxVF.inc(1) };
     VPlans.push_back(buildVPlan(SubRange));
     VF = SubRange.End;
   }
----------------
MaxVF.inc(1) can be moved outside the loop


================
Comment at: llvm/lib/Transforms/Vectorize/LoopVectorize.cpp:7661-7662
 
-  for (unsigned VF = MinVF; VF < MaxVF + 1;) {
-    VFRange SubRange = {VF, MaxVF + 1};
+  for (ElementCount VF = MinVF; ElementCount::isKnownLT(VF, MaxVF.inc(1));) {
+    VFRange SubRange = {VF, MaxVF.inc(1)};
     VPlans.push_back(buildVPlanWithVPRecipes(SubRange, NeedDef,
----------------
I'm pretty sure this inc can be moved outside also


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D90342



More information about the llvm-commits mailing list