[PATCH] D37425: LoopVectorize: MaxVF should not be larger than the loop trip count

Anna Thomas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 11 10:09:54 PDT 2017


anna added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Vectorize/LoopVectorize.cpp:6165
   if (!OptForSize) // Remaining checks deal with scalar loop when OptForSize.
     return computeFeasibleMaxVF(OptForSize);
 
----------------
zvi wrote:
> Ayal wrote:
> > Would be good to restrict MaxVF to TC even if we're not OptForSize, although it's probably less likely to have a known TC that is larger than Tiny but smaller than current MaxVF.
> Thanks for pointing that out! Created [[ https://bugs.llvm.org/show_bug.cgi?id=34468 | pr34468 ]] showing a missed opportunity for TinyTripCount < ConstTripCount < MaxVL.
This is exactly the case we are seeing. Currently, even with this patch, for loops with constant trip count = 16, we will have OptForSize as false (because TC=16 is same as TinyTripCountVectorThreshold). 

So, if the MaxVF=32, we still won't vectorize the loop. I'm working on the fix.


Repository:
  rL LLVM

https://reviews.llvm.org/D37425





More information about the llvm-commits mailing list