File: fastcc-reserved.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (59 lines) | stat: -rw-r--r-- 1,629 bytes parent folder | download | duplicates (23)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
; 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
}