• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
7declare fastcc void @will_pop([8 x i32], i32 %val)
8
9define fastcc void @foo(i32 %in) {
10; CHECK-LABEL: foo:
11
12  %addr = alloca i8, i32 %in
13
14; Normal frame setup stuff:
15; CHECK: stp     x29, x30, [sp, #-16]!
16; CHECK: mov     x29, sp
17
18; Reserve space for call-frame:
19; CHECK: str w{{[0-9]+}}, [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: mov     sp, x29
30; CHECK: ldp     x29, x30, [sp], #16
31  ret void
32}
33
34declare void @wont_pop([8 x i32], i32 %val)
35
36define void @foo1(i32 %in) {
37; CHECK-LABEL: foo1:
38
39  %addr = alloca i8, i32 %in
40; Normal frame setup again
41; CHECK: stp     x29, x30, [sp, #-16]!
42; CHECK: mov     x29, sp
43
44; Reserve space for call-frame
45; CHECK: str w{{[0-9]+}}, [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: mov     sp, x29
56; CHECK: ldp     x29, x30, [sp], #16
57  ret void
58}
59