[PATCH] D109821: [ScalarEvolution][LoopIdiom] Infer loop max trip count from array accesses

Liren.Peng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 15 03:34:10 PDT 2021


Peakulorain created this revision.
Peakulorain added reviewers: lebedev.ri, Whitney, efriedma.
Peakulorain created this object with visibility "All Users".
Peakulorain added a project: LLVM.
Herald added a subscriber: hiraditya.
Peakulorain requested review of this revision.
Herald added a subscriber: llvm-commits.

Data references in a loop should not access elements over the
statically allocated size. So we can infer a loop max trip count
from this undefined behavior.
And if we have got a certain loop bound which is small enough,
do not go through loop idiom pass because giving a libcall may
break down performance.
we can enable Loop Idiom regardless of loop trip count  by passing
“-use-lir-loop-max-tripcount=0” in command line.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D109821

Files:
  llvm/include/llvm/Analysis/ScalarEvolution.h
  llvm/lib/Analysis/ScalarEvolution.cpp
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/test/Analysis/GlobalsModRef/memset-escape.ll
  llvm/test/Transforms/InstMerge/st_sink_bugfix_22613.ll
  llvm/test/Transforms/LoopIdiom/memset_noidiom.ll
  llvm/test/Transforms/LoopIdiom/pr28196.ll
  llvm/test/Transforms/LoopIdiom/reuse-cast.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109821.372660.patch
Type: text/x-patch
Size: 9476 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210915/ed18afe1/attachment.bin>


More information about the llvm-commits mailing list