This is an archive of the discontinued LLVM Phabricator instance.

[AArch64][GlobalISel] Support lowering musttail calls
ClosedPublic

Authored by paquette on Sep 17 2019, 3:02 PM.

Details

Summary

Since we now lower most tail calls, it makes sense to support musttail.

Instead of always falling back to SelectionDAG, only fall back when a musttail call was not able to be emitted as a tail call. Once we can handle most incoming and outgoing arguments, we can change this to a report_fatal_error like in ISelLowering.

Remove the assert that we don't have varargs and a musttail, and replace it with a return false. Implementing this requires that we implement saveVarArgRegisters from AArch64ISelLowering, which is an entirely different patch.

Delete call-translator-musttail.ll, since it was just verifying that we don't tail call. Move the now-passing test to call-translator-tail-call.ll.

Add GlobalISel lines to vararg-tallcall.ll to make sure that we produce correct code. Right now we only fall back, but eventually this will be relevant.

Diff Detail

Event Timeline

paquette created this revision.Sep 17 2019, 3:02 PM
aemerson added inline comments.Sep 18 2019, 2:32 PM
llvm/lib/Target/AArch64/AArch64CallLowering.cpp
872

Do we have a test case for this?

paquette updated this revision to Diff 220757.Sep 18 2019, 3:09 PM

Add test verifying that we fall back to SelectionDAG and die when a musttail call is not lowered as a tail call.

aemerson accepted this revision.Sep 18 2019, 3:24 PM

LGTM.

This revision is now accepted and ready to land.Sep 18 2019, 3:24 PM
This revision was automatically updated to reflect the committed changes.