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

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 12:06:53 PDT 2021


jeroen.dobbelaere added a comment.

In D102255#2765788 <https://reviews.llvm.org/D102255#2765788>, @jeroen.dobbelaere wrote:

> In D102255#2755372 <https://reviews.llvm.org/D102255#2755372>, @nikic wrote:
>
>> I agree that rescheduling the loads/stores is correct even if src and dst are equal. However, the metadata itself is still incorrect: It will claim that the loads/stores are NoAlias, even though they are actually MustAlias.
>
> The proposed version introduces 2 scopes, assigning all store to one scope and all loads to another.
>
> I order to avoid the `MustAlias` vs `NoAlias` problem, we could introduce a scope per load-store pair. Of course, that might be a lot of extra scopes..

This was discussed earlier today in LLVM's AA Technical call. This method should work, but one possible gotcha came up: sometimes a memcpy lowering results in overlapping load/stores. Those overlapping load/stores must remain 'aliasing',  so they should belong to the same scope.

possible example:

  // memcpy(dst, src, 23) becomes:
  store i64 dst+0, (load i64 src+0)    // scope 0
  store i64 dst+8, (load i64, src+8)   // scope 1, not overlaping with previous pair
  store i64 dst+15, (load i64, src+15) // also scope 1, overlaping with previous pair


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