[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
Sun Jul 18 14:23:55 PDT 2021


lebedev.ri added a comment.

In D104636#2886251 <https://reviews.llvm.org/D104636#2886251>, @efriedma wrote:

> I'm not sure we actually need to version the loop to handle overflow.

That was my comment, too, and i've yet to see a concise explanation why that isn't the case.

> In any given address-space, there are at most 2^N bytes addressable by "gep ptr, i" where N is DataLayout::getIndexTypeSizeInBits().  Assuming the memset isn't volatile, there isn't any point to storing to an address more than once. So we only actually need to memset `min(2^N, TotalBytes)` bytes.  You should be able to pass that number to memset.


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