[PATCH] D71053: [LV] Take overhead of run-time checks into account during vectorization.

Evgeniy via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 5 02:30:26 PST 2019


ebrevnov created this revision.
Herald added subscribers: llvm-commits, rogfer01, rkruppe, javed.absar, bollu, hiraditya.
Herald added a reviewer: rengolin.
Herald added a project: LLVM.

Currently we reject to vectorize short trip count loops in presence of run-time checks. That is caused by inability of cost model to take overhead caused by run-time checks into account. While ideal solution would be to calculate entire cost of VPlan there is not infrastructure in place for that. I see to posibilities to mitigate that.

1. Make dry-run of SCEV expansion during main phase of cost modeling. Thus Instead of real SCEV expansion we will calculate cost of such expansion.
2. Defer cost calculation for run-time check and final decision till after run-time checks expansion. If overhead turns out to make vectorization not profitable make unconditional bypass of vectorized loop and following optimizations will remove trivially dead code.

While 1) may look like a better approach I see it as very problematic in practice. That's why I decided to go with the 2).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D71053

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/X86/optsize.ll
  llvm/test/Transforms/LoopVectorize/X86/vect.omp.force.small-tc.ll
  llvm/test/Transforms/LoopVectorize/pr39417-optsize-scevchecks.ll
  llvm/test/Transforms/LoopVectorize/pr43166-fold-tail-by-masking.ll
  llvm/test/Transforms/LoopVectorize/short_tc_rt_checks.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71053.232288.patch
Type: text/x-patch
Size: 55489 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191205/fa790607/attachment-0001.bin>


More information about the llvm-commits mailing list