[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
Tue Jun 22 02:57:13 PDT 2021


eopXD added a comment.

Accidentally marked done, undone-ed it.
No bad intentions there.



================
Comment at: llvm/test/Transforms/LoopIdiom/memset-runtime.ll:22
+; We need to add runtime checks for this optimization, and version the loop.
+; The optimized IR should be similar to the following:
+; void test(int *ar, long n)
----------------
lebedev.ri wrote:
> eopXD wrote:
> > xbolva00 wrote:
> > > So we have original loops and memset, which could be expanded to series of stores. Nightmare for codesize..
> > I think this pass does the opposite. It processes series of store of a loop into a single `memset`.
> > 
> > The code size increase scenario by this patch is when versioning happens.
> > (Original LoopIdiomRecognize doesn't involve versioning)
> > The code size increase scenario by this patch is when versioning happens.
> 
> Isn't that the @xbolva00's comment in the first place?
I think I have misunderstood the english. I originally thought series of store are multiple store instructions.

Yes, the versioning would make code size increase. I think it should be on the user whether they want this optimization to be turnt on.  I added `ForceNoLoopVersion` as a compile option. If `ForceNoLoopVersion = true`, then no runtime checks will be added and the pass will only process on constant sizes.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104636



More information about the llvm-commits mailing list