[PATCH] D133017: [LV] Use SCEV to check if the trip count <= VF * UF.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 31 06:05:09 PDT 2022


fhahn created this revision.
fhahn added reviewers: Ayal, reames, dmgreen, gilr.
Herald added subscribers: rogfer01, javed.absar, hiraditya.
Herald added a project: All.
fhahn requested review of this revision.
Herald added subscribers: pcwang-thead, vkmr.
Herald added a project: LLVM.

Just comparing constant trip counts causes LV to miss cases where the
vector loop body only executes once.

The motivation for this is to remove the need for unrolling to remove
vector loop back-edges, if the body only executes once.

It requires using non-recursive SCEV reasoning, as at this stage the CFG
is incomplete and only reasoning based on existing expression can be
used. In particular, more complex strategies like proving via induction
cannot be used, as LI/DT may be out of date.

Alternatively the result of the check could be computed earlier.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D133017

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
  llvm/lib/Transforms/Vectorize/VPlan.cpp
  llvm/lib/Transforms/Vectorize/VPlan.h
  llvm/test/Transforms/LoopVectorize/if-pred-stores.ll
  llvm/test/Transforms/LoopVectorize/induction.ll
  llvm/test/Transforms/LoopVectorize/vector-loop-backedge-elimination.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133017.456943.patch
Type: text/x-patch
Size: 12280 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220831/36a86f05/attachment.bin>


More information about the llvm-commits mailing list