[PATCH] D68484: [PATCH 01/27] [noalias] LangRef: noalias intrinsics and ptr_provenance documentation.

Jeroen Dobbelaere via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 31 00:33:25 PST 2022


jeroen.dobbelaere added a comment.

In D68484#3282674 <https://reviews.llvm.org/D68484#3282674>, @nlopes wrote:

> Access to restrict pointer is bounded by the noalias & noalias.end calls.
> Advantages:
>
> - Much simpler than the current proposal.
> - Perf improvements from day one: by tagging the intrinsics properly, LLVM's AA algorithms can already decide that %p2 doesn't alias anything else.
> - Safe from day one: no memory operations can be moved across the barriers. This is enforced by LLVM IR semantics already, no changes needed!
>
> Further perf improvements can be made, like hoisting llvm.alias intrinsics, teach LLVM that these intrinsics don't actually write to memory, etc.
>
> Essentially, I don't see a need to track provenance explicitly with metadata. It's already easily accessible. Explicit tracking adds overhead, so it has to be very well justified. Right now I don't understand the motivation.
>
> Please let me know what you think, especially what use case wouldn't work with the proposal above. Thanks!

Hi @nlopes, thanks for looking into this.

I am not sure what you expect the semantics of `@llvm.noalias` and `@llvm.noalias.end` to be. Having examples on how this is supposed to work and and to allow us to implement C99 restrict would be useful.

The current implementation is what it is because of:

- for a C99 restrict implementation, simpler is not necessarily 'correct' :(
- the need to implement the 'based on' relationship, also in a a way that clang is producing code, where this dependency is not easily seen. The same restrict pointer usage can appear in different blocks at different places. They will not be using the same '@llvm.nolias' intrinsic.
- One of the aims is also to allow memory operations to be moved across (certain) barriers as much as possible. The used intrinsics should (in the end) get completely out of the way of optimizations. The original `@llvm.noalias` is opaque, but gets converted into a `@llvm.provenance.noalias` later on which is put on the ptr_provenance path for that specific reason.


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

https://reviews.llvm.org/D68484



More information about the llvm-commits mailing list