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

Dávid Bolvanský via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 6 11:56:27 PDT 2023


xbolva00 added a comment.

In D147714#4249357 <https://reviews.llvm.org/D147714#4249357>, @efriedma wrote:

> An error message pointing at the call in the source code would be good enough, I think.  Adding a "reason" might be nice, but not strictly necessary.

Good idea. So now for:

  short i(void);
  int j(void) {
      [[clang::nonportable_musttail]]
      return i();
  }

Clang / LLVM on X86 emits:

> example.cpp:2:5: error: failed to perform tail call elimination on a call site marked musttail
> int j(void) {
>
>   ^

With debug info:

> example.cpp:4:12: error: failed to perform tail call elimination on a call site marked musttail
>
>   return i();
>          ^

Nice improvement for end users.

So if no concerns, I will do necessary modifications for other backends.


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

https://reviews.llvm.org/D147714



More information about the cfe-commits mailing list