[PATCH] D79279: Add overloaded versions of builtin mem* functions

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 23 10:43:03 PDT 2020


rjmccall added a comment.

I think the argument is treated as if it were 1 if not given.  That's all that ordinary memcpy formally guarantees, which seems to work fine (semantically, if not performance-wise) for pretty much everything today.  I don't think you need any restrictions on element size.  It's probably sensible to require the pointers to be dynamically aligned to a multiple of the access width, but I don't think you can enforce that statically.  And of course the length needs to be a multiple of the access size.

Do you think it'd be useful to have different guarantees for different operands?  I guess it could come up, but it'd be a whole lot of extra complexity that I can't imagine we'd ever support.

If one of the arguments is `volatile`, arguably the minimum access width (if given) needs to be exact.  If we don't support that right now, it's okay to make it an error, which is basically you've already done with the `_Atomic volatile` diagnostic.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79279





More information about the cfe-commits mailing list