[PATCH] D105807: [X86] pr51000 struct return tailcalling

Matheus Izvekov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 12 08:11:16 PDT 2021


mizvekov added a subscriber: haberman.
mizvekov added a comment.

In D105807#2871228 <https://reviews.llvm.org/D105807#2871228>, @urnathan wrote:

> that logic looks, at best, suspicious -- but I've not altered it.
> `  if (isTailCall && !IsMustTail) { ... check arch-specific constraints maybe clear isTailCall ... }`
> `  if (IsMustTail && !isTailCall) { .. error ..}`
> As you can see, when 'musttail' is in play we never check that ISA can actually do it.
> I don't know the semantics of musttail though -- is it 'I, the programmer, assert this is ok to tailcall', or 'I, the programmer, expect a correct tail call here'.
> If it is the former, the logic is sound, if it is the latter, it is not.  But I think that's an orthogonal issue.

It definitely means there *must* be a tail call here, otherwise we will use unbounded amount of stack :)
Ping @haberman, who worked on the DR which implemented this: https://reviews.llvm.org/D99517

I know it's orthogonal, but when I saw your patch it immediately clicked me that there is something off here.

Apologies if this is more of a LLVM musttail issue rather than clang's, and if this was already known limitation. But I feel that it is dangerous to have this attribute but then not be able to enforce it...

Thanks!


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

https://reviews.llvm.org/D105807



More information about the llvm-commits mailing list