[PATCH] D150967: [MemCpyOpt] precommit test for memcpy removal for immutable arguments from attributes (NFC)
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 4 23:56:06 PDT 2023
nikic added a comment.
In D150967#4394527 <https://reviews.llvm.org/D150967#4394527>, @khei4 wrote:
> I think if the dest is unescaped alloca, allocasize and memcpy length corresponding is unnecessary, because
>
> - If alloca length < memcpy length, memcpy is UB so we could transform it anyway?
This should be safe (though not very useful...)
> - If memcpy length < alloca length, if the alloca is unescaped transformation will widen the dereferenceability for param, but dereferenceable(bigger) subsumes dereferenceable(smaller) so, some UB will non-UB, but inverse doesn't happens. This will be valid?
>
> example: https://llvm.godbolt.org/z/Pd383eo46
In this case, the original pointer (`%val1`) is dereferenceable to 4 bytes, but the new one (`%val`) is only known dereferenceable to 1 byte, so we are replacing dereferencable(bigger) with dereferenceable(smaller), no? That wouldn't be valid.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150967/new/
https://reviews.llvm.org/D150967
More information about the llvm-commits
mailing list