[PATCH] D75981: [LV] Allow large RT checks, if they are a fraction of the scalar cost (WIP)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 04:30:38 PDT 2020


fhahn created this revision.
fhahn added reviewers: rengolin, Ayal, gilr, hsaito, anemet.
Herald added subscribers: rkruppe, hiraditya.
Herald added a project: LLVM.

This patch estimates the cost of the generated runtime checks and
relaxes the limit on the number of runtime checks, if the cost of the
runtime checks is a small fraction (0.5% of the expected scalar loop
runtime). The threshold (and other details) are not set in stone yet
and requires further  benchmarking/analysis. Also, ExpectedTC returns
the max of the induction variable for loops without known constant trip
counts, which means we largely overestimate the cost of loops with
variable trip counts.

The current version also keeps a hard limit of 2 *
NumRuntimePointerChecks, but that also needs a better look.

If the general direction is agreed upon, I will hash out the final
details.

Fixes PR43474 (modulo potential adjustments for unknown trip counts)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75981

Files:
  llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
  llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/test/Transforms/LoopVectorize/runtime-check-size-based-threshold.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75981.249581.patch
Type: text/x-patch
Size: 13899 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200311/e12f3af7/attachment.bin>


More information about the llvm-commits mailing list