This is an archive of the discontinued LLVM Phabricator instance.

Teach FastISel about thiscall (and, hence, about callee-pop).
ClosedPublic

Authored by thakis on Jul 7 2016, 3:29 PM.

Details

Reviewers
majnemer
rnk
Summary

Without this, -O0 builds fail to use fast isel on all member functions in 32-bit Windows compiles: Fast ISel walks from back to front, and each ret on a member function uses thiscall.

Even with this patch, fast isel fails to lower thiscall calls, and it never fires in 64-bit Windows compiles, since those currently have an explicit early return too. Chrome/mac debug builds of the v8_base target get ~6% slower if I disable fast isel there, so it might be worth trying to get it to fire more often in Windows debug builds.

Diff Detail

Event Timeline

thakis updated this revision to Diff 63147.Jul 7 2016, 3:29 PM
thakis retitled this revision from to Teach FastISel about thiscall (and, hence, about callee-pop)..
thakis updated this object.
thakis added reviewers: majnemer, rnk.
thakis added a subscriber: llvm-commits.
rnk edited edge metadata.Jul 7 2016, 3:46 PM

Can we test the case when the parameters are greater than 64KB? Is there some other example test that deals with the cases where we bail out?

thakis updated this revision to Diff 63153.Jul 7 2016, 4:03 PM
thakis edited edge metadata.

add test

thakis added a comment.Jul 7 2016, 4:04 PM
In D22115#477460, @rnk wrote:

Can we test the case when the parameters are greater than 64KB? Is there some other example test that deals with the cases where we bail out?

Added a test for the 64kB, based on x86-big-ret.ll. (I'm not sure I understand what you mean with the second question -- do you want more tests, or do you mean as example for how to do the 64kB test?)

rnk added a comment.Jul 7 2016, 4:14 PM
In D22115#477460, @rnk wrote:

Can we test the case when the parameters are greater than 64KB? Is there some other example test that deals with the cases where we bail out?

Added a test for the 64kB, based on x86-big-ret.ll. (I'm not sure I understand what you mean with the second question -- do you want more tests, or do you mean as example for how to do the 64kB test?)

I'm not sure what the best way is to test fast isel fallback, so I was asking if there are similar tests nearby that do it well. A lot of fastisel tests use -fast-isel-abort so that they fail if we stop being able to select simple code sequences.

thakis added a comment.Jul 7 2016, 6:49 PM

I looked through a few recent changes to X86FastISel.cpp. Most don't test the early-out branches at all. The ones that fix bugs with commit messages like "bail out to SelectionDAG since it gets this right" usually check that the right code is generated, like the new test I added now does here.

(ps: It's a bit weird that retl $65536 silently assembles to ret 0)

rnk accepted this revision.Jul 11 2016, 2:04 PM
rnk edited edge metadata.

I looked through a few recent changes to X86FastISel.cpp. Most don't test the early-out branches at all. The ones that fix bugs with commit messages like "bail out to SelectionDAG since it gets this right" usually check that the right code is generated, like the new test I added now does here.

Sounds good

(ps: It's a bit weird that retl $65536 silently assembles to ret 0)

sad trombone :(

This revision is now accepted and ready to land.Jul 11 2016, 2:04 PM
thakis closed this revision.Jul 11 2016, 6:37 PM

r275135, thanks!