[PATCH] D19487: [LV] Reallow interleaved load groups with gaps

Matthew Simpson via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 25 12:48:38 PDT 2016


mssimpso added inline comments.

================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2896
@@ +2895,3 @@
+  if (VF > 1 && Legal->requiresScalarIteration())
+    R = Builder.CreateAdd(R, Step, "n.adj");
+
----------------
sbaranga wrote:
> This doesn't look right at first sight.  Let's say we have 0 iterations in total (TC = 0), and Step is 4. If I'm not mistaken, this would underflow the VectorTripCount and give a result of MAX_UINT - 3?
> 
> Also, if the result of the URem is 0 you don't need to peel the loop (although this wouldn't be that important and perhaps not even profitable to account for).
Ah, I think you're right! Thanks for catching the underflow. For the other comment, I think you mean if the result of the URem is *not* 0, we don't need to peel. This is right, and it's something I thought about. I agree that it's probably not that important to account for, but it's definitely something we can consider. The trade-off would be something like 1 select instruction in the preheader vs. VF * UF scalar iterations.

Thanks very much for the quick feedback! I'll upload a new version soon.


http://reviews.llvm.org/D19487





More information about the llvm-commits mailing list