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

Nuno Lopes via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jan 30 04:47:24 PST 2022


nlopes added a comment.

Let me make a proposal for a simpler IR:

  declare i8* @llvm.noalias(i8*) noalias argmemonly
  declare void @llvm.noalias.end(i8*, i8*) argmemonly
  
  define @foo(i8* %ptr) {
  
  %p2 = call i8* @llvm.noalias(i8* %ptr)
  
  use %p2..
  
  call @llvm.noalias.end(i8* %ptr, i8* %p2)
  
  use %ptr..
  }

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!


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

https://reviews.llvm.org/D68484



More information about the llvm-commits mailing list