[PATCH] D79744: clang: Add address space to indirect abi info and use it for kernels

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 16 18:01:20 PDT 2020


rjmccall added a comment.

In D79744#2040348 <https://reviews.llvm.org/D79744#2040348>, @jdoerfert wrote:

> Drive by, I haven't read the entire history.
>
> In D79744#2040208 <https://reviews.llvm.org/D79744#2040208>, @rjmccall wrote:
>
> > I don't understand why `noalias` is even a concern if the whole buffer passed to the kernel is read-only.  `noalias` is primarily about proving non-interference, but if you can tell IR that the buffer is read-only, that's a much more powerful statement.
>
>
> The problem is that it is a "per-pointer" attribute and not "per-object". Given two argument pointers, where one is marked `readonly`, may still alias. Similarly, an access to a global, indirect accesses, ... can write the "readonly" memory.


Oh, do we really not have a way to mark that memory is known to be truly immutable for a time?  That seems like a really bad limitation.  It should be doable with a custom alias analysis at least.

>> Regardless, if you do need `noalias`, you should be able to emit the same IR that we'd emit if pointers to all the fields were assigned into `restrict` local variables and then only those variables were subsequently used.
> 
> We are still debating the local restrict pointer support. Once we merge that in it should be usable here.

I thought that was finished a few years ago; is it really not considered usable yet?  Or does "we" not just mean LLVM here?


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

https://reviews.llvm.org/D79744





More information about the cfe-commits mailing list