[PATCH] D131628: [LangRef] Add description for nocallback attribute

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 11 08:11:19 PDT 2022


jdoerfert added a comment.

We should use the wording of `inaccessiblememonly` here too:

  inaccessiblememonly
  
      This attribute indicates that the function may only access memory that is not accessible by the module being compiled before return from the function. This is a weaker form of readnone. If the function reads or writes other memory, the behavior is undefined.

The idea is the same. So something like:

  This attribute indicates that the function may only execute code that is not part of the module being compiled before return from the function. 

I would further restrict it to be only applicable to function declarations and call sites of such.

> What's the usefulness of this attribute? Is there any optimization that is enabled by this? It's not obvious to me, so it would be nice to document that.

We use it in the Attributor to build a better "call graph". "Default intrinsics" carry it, see https://reviews.llvm.org/D118680. This helps us to do proper reachability queries when we optimize memory accesses interprocedurally but have some intrinsic calls flying around. We also annotate external functions in the OpenMP GPU runtime for the same reason, see https://reviews.llvm.org/D112153.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131628



More information about the llvm-commits mailing list