[PATCH] D22869: [LV] Generate both scalar and vector integer induction variables

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 10:25:04 PDT 2016


anemet added a comment.

Similarly to other patch, it would be good to describe the changed functionality in this patch -- you only describe the end state.  (Sorry to keep banging on this but given the complexity I think it's crucial to keep a good a record.  In generally, it's also a good idea to have the description match the proposed commit log.  If you use arcanist, passing --verbatim to arc diff supports this flow. )

Essentially the part that is missing is the before picture which I think is this.  We used to use a scalar IV *if and only if* there was no need for a vector IV.  Otherwise we would still use the vector IV and extract the scalar value from it.  With this new patch we can now generate both and use either variant of the IV depending on the user.  Correct?


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1958-1961
@@ +1957,6 @@
+    return true;
+  for (auto *U : IV->users())
+    if (!OrigLoop->isLoopInvariant(U))
+      if (ValuesNotWidened->count(U))
+        return true;
+  return false;
----------------
Can we do this with std::any_of?

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1986
@@ +1985,3 @@
+  // variable.
+  auto *EntryVal = Trunc ? cast<Value>(Trunc) : IV;
+
----------------
Why are you calling this 'EntryVal'?


https://reviews.llvm.org/D22869





More information about the llvm-commits mailing list