This is an archive of the discontinued LLVM Phabricator instance.

[X86] Clean up the tail call eligibility logic
ClosedPublic

Authored by rnk on Oct 23 2015, 11:39 AM.

Details

Summary

The logic here isn't straightforward because our support for
TargetOptions::GuaranteedTailCallOpt.

Also fix a bug where we were allowing tail calls to cdecl functions from
fastcall and vectorcall functions. We were special casing thiscall and
stdcall callers rather than checking for any convention that requires
clearing stack arguments before returning.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk updated this revision to Diff 38245.Oct 23 2015, 11:39 AM
rnk retitled this revision from to [X86] Clean up the tail call eligibility logic.
rnk updated this object.
rnk added a reviewer: hans.
rnk added a subscriber: llvm-commits.
hans accepted this revision.Oct 23 2015, 12:34 PM
hans edited edge metadata.

LGTM, thanks!

lib/Target/X86/X86ISelLowering.cpp
2475 ↗(On Diff #38245)

ultra nit: I'd put these in the other order, so the guaranteed ones comes first, and the others read as an addition to those.

This revision is now accepted and ready to land.Oct 23 2015, 12:34 PM
rnk added inline comments.Oct 23 2015, 12:37 PM
lib/Target/X86/X86ISelLowering.cpp
2475 ↗(On Diff #38245)

I like it this way, actually, because the default calling convention is the most common and the case most people care about. Also, we don't always guarantee that the other conventions always get TCO, we only guarantee it when CodeGenOptions tells us to.

This revision was automatically updated to reflect the committed changes.