1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/AArch64/fastcc-reserved.ll
Jessica Paquette a00d53313e [AArch64][GlobalISel] Support -tailcallopt
This adds support for `-tailcallopt` tail calls to CallLowering. This
piggy-backs off the changes from D67577, since doing it without a bit of
refactoring gets extremely ugly.

Support is basically ported from AArch64ISelLowering. The main difference here
is that tail calls in `-tailcallopt` change the ABI, so there's some extra
bookkeeping for the stack.

Show that we are correctly lowering these by updating tail-call.ll.

Also show that we don't do anything strange in general by updating
fastcc-reserved.ll, which passes `-tailcallopt`, but doesn't emit any tail
calls.

Differential Revision: https://reviews.llvm.org/D67580

llvm-svn: 372177
2019-09-17 20:24:23 +00:00

60 lines
1.6 KiB
LLVM

; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -tailcallopt | FileCheck %s
; RUN: llc -global-isel -global-isel-abort=1 -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -tailcallopt | FileCheck %s
; This test is designed to be run in the situation where the
; call-frame is not reserved (hence disable-fp-elim), but where
; callee-pop can occur (hence tailcallopt).
declare fastcc void @will_pop([8 x i64], i32 %val)
define fastcc void @foo(i32 %in) {
; CHECK-LABEL: foo:
%addr = alloca i8, i32 %in
; Normal frame setup stuff:
; CHECK: stp x29, x30, [sp, #-16]!
; CHECK: mov x29, sp
; Reserve space for call-frame:
; CHECK: str w{{[0-9]+}}, [sp, #-16]!
call fastcc void @will_pop([8 x i64] undef, i32 42)
; CHECK: bl will_pop
; Since @will_pop is fastcc with tailcallopt, it will put the stack
; back where it needs to be, we shouldn't duplicate that
; CHECK-NOT: sub sp, sp, #16
; CHECK-NOT: add sp, sp,
; CHECK: mov sp, x29
; CHECK: ldp x29, x30, [sp], #16
ret void
}
declare void @wont_pop([8 x i64], i32 %val)
define void @foo1(i32 %in) {
; CHECK-LABEL: foo1:
%addr = alloca i8, i32 %in
; Normal frame setup again
; CHECK: stp x29, x30, [sp, #-16]!
; CHECK: mov x29, sp
; Reserve space for call-frame
; CHECK: str w{{[0-9]+}}, [sp, #-16]!
call void @wont_pop([8 x i64] undef, i32 42)
; CHECK: bl wont_pop
; This time we *do* need to unreserve the call-frame
; CHECK: add sp, sp, #16
; Check for epilogue (primarily to make sure sp spotted above wasn't
; part of it).
; CHECK: mov sp, x29
; CHECK: ldp x29, x30, [sp], #16
ret void
}