[PATCH] D67939: [AArch64][GlobalISel] Choose CCAssignFns per-argument for tail call lowering

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 16:02:50 PDT 2019


paquette created this revision.
paquette added a reviewer: aemerson.
Herald added subscribers: Petar.Avramovic, volkan, hiraditya, kristof.beyls, rovka.
Herald added a project: LLVM.

When checking for tail call eligibility, we should use the correct CCAssignFn for each argument, rather than just checking if the caller/callee is varargs or not.

This is important for tail call lowering with varargs. If we don't check it, then basically any varargs callee with parameters cannot be tail called on Darwin, for one thing. If the parameters are all guaranteed to be in registers, this should be entirely safe.

On top of that, not checking for this could potentially make it so that we have the wrong stack offsets when checking for tail call eligibility.

Also refactor some of the stuff for CCAssignFnForCall and pull it out into a helper function.

Update call-translator-tail-call.ll to show that we can now correctly tail call on Darwin. Also add two extra tail call checks. The first verifies that we still respect the caller's stack size, and the second verifies that we still don't tail call when a varargs function has a memory argument.


https://reviews.llvm.org/D67939

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/lib/Target/AArch64/AArch64CallLowering.cpp
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67939.221427.patch
Type: text/x-patch
Size: 13647 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190923/2731ed6e/attachment.bin>


More information about the llvm-commits mailing list