[PATCH] D102255: [SelectionDAG] Generate scoped AA metadata when loweing memcpy.

Michael Liao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 11 13:17:37 PDT 2021


hliao added a comment.

In D102255#2751896 <https://reviews.llvm.org/D102255#2751896>, @nikic wrote:

> Do I understand correctly that this patch is trying to claim that the memcpy src and dst do not alias through scoped alias metadata? If so, I'm afraid this is incorrect. Our contract for `llvm.memcpy` requires that src/dst are either NoAlias or MustAlias (but not PartialAlias). From LangRef:
>
>> The ‘llvm.memcpy.*’ intrinsics copy a block of memory from the source location to the destination location, which must either be equal or non-overlapping.

The langref says "The ‘llvm.memcpy.*’ intrinsics copy a block of memory from the source location to the destination location, which must either be equal or non-overlapping. It copies “len” bytes of memory over. If the argument is known to be aligned to some boundary, this can be specified as an attribute on the argument.". It says that src and dst are either equal or non-overlapping. For the equal case, they should be eliminated earlier. Even if there are remaining ones, claiming them 'NoAlias' doesn't have impact when copying them. It won't cause correctness issue if we schedule those loads and stores freely.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102255



More information about the llvm-commits mailing list