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

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 2 09:30:12 PST 2020


rjmccall added a comment.

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.


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

https://reviews.llvm.org/D75423





More information about the cfe-commits mailing list