[PATCH] D75980: [LV] Generate RT checks up-front and remove them if required. (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: llvm-commits, rogfer01, rkruppe, bollu, hiraditya.
Herald added a project: LLVM.

This patch updates LV to generate the runtime checks just after cost
modeling, to allow a more precise estimate of the actual cost of the
checks. This information will be used in future patches to generate
larger runtime checks in cases where the checks only make up a small
fraction of the expected scalar loop execution time.

The runtime checks are created up-front in a temporary block to allow better
estimating the cost and un-linked from the existing IR. After deciding to
vectorize, the checks are moved backed. If deciding not to vectorize, the
temporary block is completely removed.

This patch is similar in spirit to D71053 <https://reviews.llvm.org/D71053>, but explores a different
direction: instead of delaying the decision on whether to vectorize in
the presence of runtime checks it instead optimistically creates the
runtime checks early and discards them later if decided to not
vectorize. This has the advantage that the cost-modeling decisions
can be kept together and can be done up-front and thus preserving the
general code structure. I think delaying (part) of the decision to
vectorize would also make the VPlan migration a bit harder.

One potential drawback of this patch is that we speculatively
generate IR which we might have to clean up later. However it seems like
the code required to do so is quite manageable.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75980

Files:
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

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


More information about the llvm-commits mailing list