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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 21 05:58:28 PDT 2021


lebedev.ri added a comment.

In D104636#2830333 <https://reviews.llvm.org/D104636#2830333>, @eopXD wrote:

> In D104636#2830325 <https://reviews.llvm.org/D104636#2830325>, @lebedev.ri wrote:
>
>> Why is this beneficial?
>
> I shall quote from D104179 <https://reviews.llvm.org/D104179> as @qianzhen stated this optimization clearly:
>
>> When the loop idiom transformation processes a memset instruction in a loop, currently it only handles the memset with a compile-time constant size. The motivation of this work is to relax this limitation, so that a memset with a variable size in a loop may still be processed and promoted to a larger memset if it passes all the eligibility checks. Performance-wise, promoting the memset in a loop to a larger memset reduces the number of calls to memset; hence reducing the overall call overhead.
>> A similar technique may also apply to the memcpy with a variable size in a loop.

This only reiterates what this patch does, which was pretty obvious, and does not answer my question.
More concretely, can the scalar loop be expected to clear more than `i64 -1` bytes of memory?
If not, why can't the byte count to be cleared can't be calculated by promoting to i64, and multiplying with saturation?


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