This is an archive of the discontinued LLVM Phabricator instance.

X86ISelLowering: Support tail calls to/from thiscall functions
ClosedPublic

Authored by hans on Oct 22 2015, 3:49 PM.

Details

Summary

This saves 16.5 KB on a Clang bootstrap. I'm hoping for more on Chromium, but haven't measured yet.

Diff Detail

Repository
rL LLVM

Event Timeline

hans updated this revision to Diff 38184.Oct 22 2015, 3:49 PM
hans retitled this revision from to X86ISelLowering: Support tail calls to/from thiscall functions.
hans updated this object.
hans added reviewers: rnk, hansw.
hans added a subscriber: llvm-commits.
hans added a comment.Oct 22 2015, 6:06 PM

(In a Chrome official build, this saves 124 KB over chrome.exe, chrome.dll and chrome_child.dll.)

rnk edited edge metadata.Oct 23 2015, 10:46 AM

Can we generalize this logic to all conventions that are isCalleePop? Then it will cover stdcall, fastcall, and vectorcall.

hans updated this revision to Diff 38274.Oct 23 2015, 4:03 PM
hans edited edge metadata.

Thanks for landing r251137!

Updated the patch to support the other calling conventions too.

rnk accepted this revision.Oct 23 2015, 6:45 PM
rnk edited edge metadata.

lgtm

lib/Target/X86/X86ISelLowering.cpp
3741 ↗(On Diff #38274)

This doesn't need an extra blank line

3806–3808 ↗(On Diff #38274)

I think factoring out the negation will make this more readable:

bool CalleePopMatches = CalleeWillPop && BytesToPop == StackArgSize;
if (!CalleePopMatches)
  return false;
test/CodeGen/X86/tailcall-msvc-conventions.ll
146 ↗(On Diff #38274)

s/aruments/arguments/

This revision is now accepted and ready to land.Oct 23 2015, 6:45 PM
This revision was automatically updated to reflect the committed changes.
hans marked 3 inline comments as done.