[PATCH] D104636: [LoopIdiom] [LoopNest] let the pass deal with runtime memset size

Yueh-Ting Chen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 15 02:38:20 PDT 2021


eopXD updated this revision to Diff 358877.
eopXD added a comment.

Address comments.

1. Make processLoopMemset able to deal with smax expressions with constant operands that are loop guards.

  How: If operands are constant, we can fold them and add runtime checks when we

  	      version and make sure our folding on smax is safe.

2. Added nested testcase that shows the necessity of using LoopNest.

  	 Why: If we use the current LIR with this patch, which seeks to optimize on
  	 runtime determined variables, the versioning would happen loop-by-loop.
  	 In other word, the pass would need to generate versioning for every loop until
  	 the pass hoists the memset to the outermost-loop's preheader.
     The LNIR (LoopNestIdiomRecognize) would make only 1 versioning outside of the
  	 outer-most loop to prevent this from happening.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104636/new/

https://reviews.llvm.org/D104636

Files:
  llvm/include/llvm/Transforms/Scalar/LoopIdiomRecognize.h
  llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp
  llvm/test/Transforms/LoopIdiom/memset-runtime.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D104636.358877.patch
Type: text/x-patch
Size: 35625 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210715/50884bc7/attachment.bin>


More information about the llvm-commits mailing list