xref: /llvm-project/llvm/test/CodeGen/AArch64/sve-callbyref-notailcall.ll (revision 672f673004663aeb15ece1af4b5b219994924167)
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 | FileCheck %s
4
5; CHECK-LABEL: caller:
6; CHECK:       addvl sp, sp, #-[[STACKSIZE:[0-9]+]]
7; CHECK-NOT:   addvl sp
8; CHECK:       bl callee
9; CHECK:       addvl sp, sp, #[[STACKSIZE]]
10; CHECK:       ret
11define <vscale x 16 x i8> @caller(<vscale x 16 x i8> %v) {
12  %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)
13  ret <vscale x 16 x i8> %1
14}
15
16declare <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>)
17
18; CHECK-LABEL: caller_pred:
19; CHECK:       addvl sp, sp, #-[[STACKSIZE:[0-9]+]]
20; CHECK-NOT:   addvl sp
21; CHECK:       bl callee_pred
22; CHECK:       addvl sp, sp, #[[STACKSIZE]]
23; CHECK:       ret
24define <vscale x 16 x i1> @caller_pred(<vscale x 16 x i1> %v) {
25  %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)
26  ret <vscale x 16 x i1> %1
27}
28
29declare <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>)
30