[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 22 09:16:35 PDT 2021


eopXD added a comment.

Hi @efriedma,

I am not sure consecutive memory won't exceed 2^N bytes, but we cannot think of a scenario that it can. Thank you for stating this valid point.

However the current code inside `LoopIdiomRecognize::processLoopMemset` , for the constant size the pass would also check for size overflow. I am curious of why it is originally needed here? Do you have any idea why is the check needed? (the commit history is out of the Phabricator's reach)

  // Reject memsets that are so large that they overflow an unsigned.
    uint64_t SizeInBytes = cast<ConstantInt>(MSI->getLength())->getZExtValue();
    if ((SizeInBytes >> 32) != 0)
      return false;



---

Assume we don't need runtime check for size overflow, we still need runtime checks for the assumptions made to fold SCEV expressions that enable the optimization. So versioning would still be needed.


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