[PATCH] D86815: [LangRef] Adjust guarantee for llvm.memcpy to also allow equal arguments.
John McCall via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 1 12:22:11 PDT 2020
rjmccall added a comment.
In D86815#2250283 <https://reviews.llvm.org/D86815#2250283>, @fhahn wrote:
> In D86815#2249028 <https://reviews.llvm.org/D86815#2249028>, @nlopes wrote:
>
>> In D86815#2245481 <https://reviews.llvm.org/D86815#2245481>, @rsmith wrote:
>>
>>> There is a longstanding assumption made by ~every compiler that `memcpy(p, p, n)` is safe. That's what we should be encoding here. We should not be removing all overlap restrictions.
>>
>> If clang doesn't have a document stating the assumptions made about the run-time libraries (couldn't quickly find it), it might be useful to have one and mention this.
>
> That sounds good, but I am not sure where this should be documented on the Clang side. I think this can also be done separately.
I agree that Clang should document this. Isn't there another technically-undefined assumption that LLVM makes about memcpy, like that it accepts bad pointers if the size is zero? Seems like that should be documented in the same place.
That place is probably the same general section of the manual that documents our implementation-defined behavior and implementation limits, which, er, doesn't currently exist.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86815/new/
https://reviews.llvm.org/D86815
More information about the llvm-commits
mailing list