[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 11:36:33 PST 2020


rjmccall added a comment.

In D75423#1901407 <https://reviews.llvm.org/D75423#1901407>, @yaxunl wrote:

> In D75423#1901362 <https://reviews.llvm.org/D75423#1901362>, @rjmccall wrote:
>
> > Okay, then I have no problem taking a patch for this into IRGen.  But I think it should be fine to do this by adding the invariant-load metadata when loading from an l-value instead of injecting invariant-groups into l-value emission.
>
>
> The pointer to constant may be casted to a generic pointer then loaded. If we only mark load from pointer to constant, we loses information.


A lot of those conversions don't go through `EmitLValue`.

Doing this at this level in `EmitLValue` both complicates the code and will introduce a lot of redundant intrinsic calls.  If you need to do it, you should do it at the root where a pointer is being turned into an LValue.


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

https://reviews.llvm.org/D75423





More information about the cfe-commits mailing list