[PATCH] D67471: [AArch64][GlobalISel] Support sibling calls with outgoing arguments

Jessica Paquette via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 15:10:51 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.
paquette added a parent revision: D67465: [GlobalISel][AArch64] Check caller for swifterror params in tailcall eligibility.

This adds support for lowering sibling calls with outgoing arguments.

e.g

  define void @foo(i32 %a)

Support is ported from AArch64ISelLowering's `isEligibleForTailCallOptimization`. The only thing that is missing is a full port of `TargetLowering::parametersInCSRMatch`. So, if we're using swiftself, we'll never tail call.

- Rename `analyzeCallResult` to `analyzeArgInfo`, since the function is now used for both outgoing and incoming arguments
- Teach `OutgoingArgHandler` about tail calls. Tail calls use frame indices for stack arguments.
- Teach `lowerFormalArguments` to set the bytes in the caller's stack argument area. This is used later to check if the tail call's parameters will fit on the caller's stack.
- Add `areCalleeOutgoingArgsTailCallable` to perform the eligibility check on the callee's outgoing arguments.

For testing:

- Update call-translator-tail-call to verify that we can now tail call with outgoing arguments, use G_FRAME_INDEX for stack arguments, and respect the size of the caller's stack
- Remove GISel-specific check lines from speculation-hardening.ll, since GISel now tail calls like the other selectors
- Add a GISel test line to tailcall-string-rvo.ll since we can tail call in that test now
- Add a GISel test line to tailcall_misched_graph.ll since we tail call there now. Add specific check lines for GISel, since the debug output from the machine-scheduler differs with GlobalISel. The dependency still holds, but the output comes out in a different order.


https://reviews.llvm.org/D67471

Files:
  llvm/include/llvm/CodeGen/GlobalISel/CallLowering.h
  llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
  llvm/lib/Target/AArch64/AArch64CallLowering.cpp
  llvm/lib/Target/AArch64/AArch64CallLowering.h
  llvm/test/CodeGen/AArch64/GlobalISel/call-translator-tail-call.ll
  llvm/test/CodeGen/AArch64/arm64-call-tailcalls.ll
  llvm/test/CodeGen/AArch64/speculation-hardening.ll
  llvm/test/CodeGen/AArch64/tailcall-string-rvo.ll
  llvm/test/CodeGen/AArch64/tailcall_misched_graph.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67471.219812.patch
Type: text/x-patch
Size: 21783 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190911/c25a5326/attachment.bin>


More information about the llvm-commits mailing list