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

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 29 11:26:35 PDT 2016


mssimpso added a comment.

Adam,

That's exactly right. I'll be sure to use that language in the commit log. Echoing what you said for the record: Previously, we only used the scalar IV if we knew all users were going to be scalar. In the case of a loop with both scalar and vector users, we would generate the vector IV and extract scalar values from it for the scalar users. The functional change here is that now when there are both scalar and vector users, we generate both versions of the IV and select which version to use based on whether the user is scalar or vector.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:1971-1974
@@ -1967,6 +1970,6 @@
   // If the instruction is not in the loop, or if it is uniform after
   // vectorization, it will remain scalar.
   if (Uniforms.count(I) || !TheLoop->contains(I))
     return true;
 
   // If the instruction is a getelementptr that will not be vectorized for a
----------------
Yes, I think so! I'll update the patch.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2044
@@ +2043,3 @@
+  // variable.
+  Instruction *EntryVal = Trunc ? cast<Instruction>(Trunc) : IV;
+
----------------
It's the entry value in WidenMap. For the truncation case, the truncate instruction maps to the new narrow IV. I'm happy to rename this though. I probably went with EntryVal because I couldn't think of anything better at the time.


https://reviews.llvm.org/D22869





More information about the llvm-commits mailing list