1 ; RUN: llc -verify-machineinstrs < %s -mtriple=aarch64-none-linux-gnu -tailcallopt | FileCheck %s 2 3 ; This test is designed to be run in the situation where the 4 ; call-frame is not reserved (hence disable-fp-elim), but where 5 ; callee-pop can occur (hence tailcallopt). 6 7 declare fastcc void @will_pop([8 x i32], i32 %val) 8 9 define fastcc void @foo(i32 %in) { 10 ; CHECK-LABEL: foo: 11 12 %addr = alloca i8, i32 %in 13 14 ; Normal frame setup stuff: 15 ; CHECK: sub sp, sp, 16 ; CHECK: stp x29, x30 17 18 ; Reserve space for call-frame: 19 ; CHECK: sub sp, sp, #16 20 21 call fastcc void @will_pop([8 x i32] undef, i32 42) 22 ; CHECK: bl will_pop 23 24 ; Since @will_pop is fastcc with tailcallopt, it will put the stack 25 ; back where it needs to be, we shouldn't duplicate that 26 ; CHECK-NOT: sub sp, sp, #16 27 ; CHECK-NOT: add sp, sp, 28 29 ; CHECK: ldp x29, x30 30 ; CHECK: add sp, sp, 31 ret void 32 } 33 34 declare void @wont_pop([8 x i32], i32 %val) 35 36 define void @foo1(i32 %in) { 37 ; CHECK-LABEL: foo1: 38 39 %addr = alloca i8, i32 %in 40 ; Normal frame setup again 41 ; CHECK: sub sp, sp, 42 ; CHECK: stp x29, x30 43 44 ; Reserve space for call-frame 45 ; CHECK: sub sp, sp, #16 46 47 call void @wont_pop([8 x i32] undef, i32 42) 48 ; CHECK: bl wont_pop 49 50 ; This time we *do* need to unreserve the call-frame 51 ; CHECK: add sp, sp, #16 52 53 ; Check for epilogue (primarily to make sure sp spotted above wasn't 54 ; part of it). 55 ; CHECK: ldp x29, x30 56 ; CHECK: add sp, sp, 57 ret void 58 } 59