[PATCH] D99517: Implemented [[clang::musttail]] attribute for guaranteed tail calls.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 10 11:20:44 PDT 2021


rjmccall added a comment.

It's not generically true that "anything can be tail-called if it's `noreturn`".  For one, `noreturn` doesn't imply that the function doesn't exit by e.g. throwing or calling `longjmp`.  For another, the most important user expectation of tail calls is that a long series of tail calls will exhibit zero overall stack growth; in a caller-pop calling convention, calling a function with more parameters may require growing the argument area in a way that cannot be reversed, so e.g. a long sequence of tail calls alternating between 1-argument and 2-argument functions will eventually exhaust the stack, which violates that user expectation.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99517



More information about the cfe-commits mailing list