2014-05-24 20:50:23 +08:00
|
|
|
; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -tailcallopt | FileCheck %s
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; 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 i32], i32 %val)
|
|
|
|
|
|
|
|
define fastcc void @foo(i32 %in) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: foo:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%addr = alloca i8, i32 %in
|
|
|
|
|
|
|
|
; Normal frame setup stuff:
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: stp x29, x30, [sp, #-16]!
|
|
|
|
; CHECK: mov x29, sp
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; Reserve space for call-frame:
|
2015-10-01 03:44:40 +08:00
|
|
|
; CHECK: str w{{[0-9]+}}, [sp, #-16]!
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
call fastcc void @will_pop([8 x i32] 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,
|
|
|
|
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: mov sp, x29
|
|
|
|
; CHECK: ldp x29, x30, [sp], #16
|
2013-01-31 20:12:40 +08:00
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @wont_pop([8 x i32], i32 %val)
|
|
|
|
|
|
|
|
define void @foo1(i32 %in) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-LABEL: foo1:
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
%addr = alloca i8, i32 %in
|
|
|
|
; Normal frame setup again
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: stp x29, x30, [sp, #-16]!
|
|
|
|
; CHECK: mov x29, sp
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; Reserve space for call-frame
|
2015-10-01 03:44:40 +08:00
|
|
|
; CHECK: str w{{[0-9]+}}, [sp, #-16]!
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
call void @wont_pop([8 x i32] undef, i32 42)
|
2013-03-10 02:25:40 +08:00
|
|
|
; CHECK: bl wont_pop
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; This time we *do* need to unreserve the call-frame
|
2013-03-10 02:25:40 +08:00
|
|
|
; CHECK: add sp, sp, #16
|
2013-01-31 20:12:40 +08:00
|
|
|
|
|
|
|
; Check for epilogue (primarily to make sure sp spotted above wasn't
|
|
|
|
; part of it).
|
2014-05-24 20:50:23 +08:00
|
|
|
; CHECK: mov sp, x29
|
|
|
|
; CHECK: ldp x29, x30, [sp], #16
|
2013-01-31 20:12:40 +08:00
|
|
|
ret void
|
|
|
|
}
|