[PATCH] D75423: [OpenCL] Mark pointers to constant address space as invariant

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 09:38:40 PST 2020


yaxunl added a comment.

In D75423#1901254 <https://reviews.llvm.org/D75423#1901254>, @rjmccall wrote:

> In D75423#1901206 <https://reviews.llvm.org/D75423#1901206>, @hliao wrote:
>
> > invariant checking already takes account of loading from constant address space or memory (AA::pointsToConstantMemory), that's almost equivalent to adding invariant attributes. Why do we mark these constant loads with additional attributes?
>
>
> If alias analysis already knows that all memory in the constant address space is immutable,  I agree that should be sufficient, at least on targets where the constant address space is actually a different address space in LLVM IR.  If it only knows that when it can resolve an access down to a specific `constant` global variable, this patch is still providing value because it applies even for accesses through a pointer.


There is plan for amdgcn target to drop constant address space in IR and use global address space instead.

Also, currently there are targets (e.g. x86_64) supporting OpenCL which does not have constant address space in IR.


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

https://reviews.llvm.org/D75423





More information about the cfe-commits mailing list