[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
Sun Jul 18 10:13:45 PDT 2021


eopXD added a comment.

In D104636#2879853 <https://reviews.llvm.org/D104636#2879853>, @yurai007 wrote:

> But how useful such transformation would be in practice? I'm not sure. We need to keep in mind that memset is usually just part of initialization/reusing memory code so in real world benchmarks flattening memsets loop may be less beneficial than microbenchmarks shows.

In Fortran, initialization of multi-dimensional arrays uses one liners like

  A = 0.0

When `A` is multi-dimensional, it would be converted to loop-nests in LLVM-IR. For example if `A` is 3-D then the LLVM IR would be like the following. This nested store operation pattern is a common pattern to exist in the language of Fortran.

  for i ...
    for j ...
      for k ...
        A[i][j][k] = 0;


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