[PATCH] D147714: [Attr] Introduce [[clang::nonportable_musttail]] as less strict version of [[clang::musttail]]

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 7 11:18:56 PDT 2023


erichkeane added a comment.

In D147714#4251690 <https://reviews.llvm.org/D147714#4251690>, @haberman wrote:

>> is a [[should_tail]] attribute sort of thing: a tail-hint where we do 'best effort with no promises', and make no guarantees that we're going to tail it.
>
> I'm not sure I see the value in that. The compiler already optimizes tail calls when it can in a best-effort manner. The purpose of `[[musttail]]` is to support algorithms that would blow the stack if tail calls were not optimized. It's better to get a compiler error than to get a stack overflow at runtime (especially if stack overflow only occurs with certain inputs).

I see, yes, that makes sense.  Then I go back to my other suggestion: we this needs to encode the per-platform limitations in Sema.

I could definitely see this being an 'alias' for `musttail` on most platforms, and us reducing the restrictions over time on a per-platform basis though, so long as we knew codegen would be compatible with it.


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

https://reviews.llvm.org/D147714



More information about the cfe-commits mailing list