• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; Because some arguments are passed by reference (through stack),
2; the compiler should not do tail-call optimization.
3; RUN: llc -mtriple=aarch64 -mattr=+sve < %s 2>%t | FileCheck %s
4; RUN: FileCheck --check-prefix=WARN --allow-empty %s <%t
5
6; If this check fails please read test/CodeGen/AArch64/README for instructions on how to resolve it.
7; WARN-NOT: warning
8
9; CHECK-LABEL: caller:
10; CHECK:       addvl sp, sp, #-[[STACKSIZE:[0-9]+]]
11; CHECK-NOT:   addvl sp
12; CHECK:       bl callee
13; CHECK:       addvl sp, sp, #[[STACKSIZE]]
14; CHECK:       ret
15define <vscale x 16 x i8> @caller(<vscale x 16 x i8> %v) {
16  %1 = tail call <vscale x 16 x i8> @callee(<vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v, <vscale x 16 x i8> %v)
17  ret <vscale x 16 x i8> %1
18}
19
20declare <vscale x 16 x i8> @callee(<vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>, <vscale x 16 x i8>)
21
22; CHECK-LABEL: caller_pred:
23; CHECK:       addvl sp, sp, #-[[STACKSIZE:[0-9]+]]
24; CHECK-NOT:   addvl sp
25; CHECK:       bl callee_pred
26; CHECK:       addvl sp, sp, #[[STACKSIZE]]
27; CHECK:       ret
28define <vscale x 16 x i1> @caller_pred(<vscale x 16 x i1> %v) {
29  %1 = tail call <vscale x 16 x i1> @callee_pred(<vscale x 16 x i1> %v, <vscale x 16 x i1> %v, <vscale x 16 x i1> %v, <vscale x 16 x i1> %v, <vscale x 16 x i1> %v)
30  ret <vscale x 16 x i1> %1
31}
32
33declare <vscale x 16 x i1> @callee_pred(<vscale x 16 x i1>, <vscale x 16 x i1>, <vscale x 16 x i1>, <vscale x 16 x i1>, <vscale x 16 x i1>)
34