[PATCH] D50480: [LV] Vectorizing loops of arbitrary trip count without remainder under opt for size

Hideki Saito via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 14 15:24:50 PDT 2018


hsaito added inline comments.


================
Comment at: lib/Transforms/Vectorize/LoopVectorize.cpp:2673
   // unroll factor (number of SIMD instructions).
-  Constant *Step = ConstantInt::get(TC->getType(), VF * UF);
   Value *R = Builder.CreateURem(TC, Step, "n.mod.vf");
 
----------------
Ayal wrote:
> hsaito wrote:
> > This Urem creation should be skipped if we aren't generating remainder.
> This Urem is also used to round N up to a multiple of Step, i.e., when we're not generating remainder.
Ouch. Well, given the assertion for VF*UF being power of two (constant), the UREM and other computation should be reasonably optimizable downstream. So, it's probably unfair to ask you to fix the trip count computation ---- so, I won't ask. There is a trade off between generating more optimal output IR and the cost of maintaining the code to do that. Keeping UREM here is opting for lower maintenance. Just for the record.


Repository:
  rL LLVM

https://reviews.llvm.org/D50480





More information about the llvm-commits mailing list