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

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 14:19:33 PDT 2022


jdoerfert added a comment.

In D131628#3724395 <https://reviews.llvm.org/D131628#3724395>, @mysterymath wrote:

> In D131628#3724307 <https://reviews.llvm.org/D131628#3724307>, @jdoerfert wrote:
>
>>> The linker must always drop nocallback.
>>
>> Yes, let's do that. We'll create a patch. Also for `inaccessiblememonly` and friends, see below.
>
> If inaccessiblememonly is generated internally with the expectation of a per-translation-unit semantics, then it makes sense to summarily drop it.
> But unless someone already has, we really should verify that `__attribute__((leaf))` actually does have per-translation-unit semantics in GCC LTO, not per LTO-unit. I wouldn't be surprised if this feature predates LTO, and some kind of naive module merging in GCC may give it identical semantics to the one we have today.
>
> There's even a case to be made for the LTO unit interpretation; it allows you to declare a function to effectively be a leaf if it can't call anything that could possible be included in the current LTO unit. This would allow pruning the reachability graph more thoroughly in LTO than the other interpretation, and I'd argue that this attribute is primarily useful for functions that are actually or approximately leaf functions.

For both, inaccessiblememonly and nocallback I agree. I also expect our use case to "opt-out" of the default dropping by the linker. We really want/need this for "external" functions, like non-LTO module external, e.g., provided by the runtime system.


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