[PATCH] D90275: [clang][IR] Add support for leaf attribute
Roland McGrath via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 3 17:47:14 PST 2020
mcgrathr added a comment.
The GCC documentation specifically gives the example of the standard C function `qsort` as one that does not qualify as `__attribute__((leaf))` because it uses a callback function (that presumably might be from the caller's own TU). AIUI the claim the attribute makes is that no normal control flow (i.e. excluding only signal handlers) would call any function in the caller's TU by any means, nor `longjmp` to any state captured by a `setjmp` call in the caller's TU, and thus only normal return or normal C++ exception handling return/unwind would reach the caller's TU again after the jump (call) to this entry point. The caller is thus presumed not to share potentially-called functions with the callee by any means, whether direct symbol references or function pointers passed in the call or function pointers previously stored somewhere (e.g. a C++ vtable). The compiler can make whatever assumptions about potential dataflow/side-effect and the like are implied by this exclusion of TU-local code paths from the otherwise unknown call graph of the external call.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D90275/new/
https://reviews.llvm.org/D90275
More information about the cfe-commits
mailing list