[PATCH] D30247: Epilog loop vectorization

Ashutosh Nema via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 6 00:52:02 PST 2017


ashutosh.nema added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3280
+  // Should be legal to vectorize.
+  if (!LVL.canVectorize()) {
+    DEBUG(dbgs() << "MVer-LV: Not vectorizing: Cannot prove legality.\n");
----------------
We can remove call to loop vectorizer’s legality before widening epilog loop, as legality is already proven for scalar loop while generating first vector version, it’s not required to prove again as scalar body has not changed. Epilog vectorization will depend on already computed legality. I have tried this change and found no impacts in my regular tests & benchmarks.

Please let me know thoughts on this.



================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:3345
+  }
+  DEBUG(dbgs() << "Epilog vectorization is beneficial with width : "
+               << EpilogVectorLoopWidth << " in Function: "
----------------
rengolin wrote:
> So, you're assuming that just having more than 16 iterations is "beneficial", but you haven't done any cost analysis. It may very well be that the cost is just not worth it, especially for smaller vector sizes.
Costing is already done, during the cost calculation of first vector version we have preserved the profitable VFs.
At this point we look for the next profitable vector factor and widen epilog loop with it.



Repository:
  rL LLVM

https://reviews.llvm.org/D30247





More information about the llvm-commits mailing list