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

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 13 12:28:04 PDT 2021


lebedev.ri accepted this revision.
lebedev.ri added a comment.

In D107353#2944315 <https://reviews.llvm.org/D107353#2944315>, @efriedma wrote:

> In D107353#2944152 <https://reviews.llvm.org/D107353#2944152>, @lebedev.ri wrote:
>
>> In D107353#2944144 <https://reviews.llvm.org/D107353#2944144>, @eopXD wrote:
>>
>>> No code for saturation here.
>>> I thought restricting to address space zero prevents the need of saturation.
>>
>> @efriedma does that sound right?
>
> I think I mentioned this on the other bug... but sounds right to me; overflow implies undefined behavior.  If the amount does overflow, that means the memset is writing at least once to every byte in the address space.  Among other things, that implies a store to null.

Well, alrighy then.
@efriedma feel like stamping this too then?



================
Comment at: llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:930
+    // Memset size is constant.
+    // Reject memsets that are so large that they overflow an unsigned.
+    // Check to see if the stride matches the size of the memset.  If so, then
----------------
Comment needs updating?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D107353



More information about the llvm-commits mailing list