[PATCH] D34373: [LV] Optimize for size when vectorizing loops with tiny trip count

Ayal Zaks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 19 16:49:24 PDT 2017


Ayal created this revision.
Herald added a subscriber: mzolotukhin.

Try to vectorize loops whose trip-count is smaller than TinyTripCountVectorThreshold under OptForSize constraint rather than not trying to vectorize them at all. The OptForSize constraint implies little if any overheads outside of the vectorized loop body, so the current cost estimate of the vectorized-vs-scalar loop body should hopefully be more/sufficiently accurate.

Also holds when the small value of the trip-count is based on profile data rather than static analysis, for potential cases where the trip-count is statically known to be divisible by the VF.

Patch inspired by https://reviews.llvm.org/D32451.


https://reviews.llvm.org/D34373

Files:
  lib/Transforms/Vectorize/LoopVectorize.cpp
  test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll
  test/Transforms/LoopVectorize/small-loop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34373.103123.patch
Type: text/x-patch
Size: 6882 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170619/04b0f256/attachment.bin>


More information about the llvm-commits mailing list