xref: /llvm-project/llvm/test/CodeGen/AArch64/darwinpcs-tail.ll (revision 5ddce70ef0e5a641d7fea95e31fc5e2439cb98cb)
1; With Darwin PCS, non-virtual thunks generated are generated with musttail
2; and are expected to build
3; In general Darwin PCS should be tail optimized
4; RUN: llc -mtriple=arm64-apple-ios5.0.0 < %s | FileCheck %s
5
6; CHECK-LABEL: __ZThn16_N1C3addEPKcz:
7; CHECK:       b __ZN1C3addEPKcz
8; CHECK-LABEL: _tailTest:
9; CHECK:       b __ZN1C3addEPKcz
10; CHECK-LABEL: __ZThn8_N1C1fEiiiiiiiiiz:
11; CHECK:       ldr     w9, [sp, #4]
12; CHECK:       str     w9, [sp, #4]
13; CHECK:       b __ZN1C1fEiiiiiiiiiz
14
15%class.C = type { %class.A.base, [4 x i8], %class.B.base, [4 x i8] }
16%class.A.base = type <{ ptr, i32 }>
17%class.B.base = type <{ ptr, i32 }>
18
19declare void @_ZN1C3addEPKcz(ptr, ptr, ...) unnamed_addr #0 align 2
20
21define void @_ZThn16_N1C3addEPKcz(ptr %0, ptr %1, ...) unnamed_addr #0 align 2 {
22  musttail call void (ptr, ptr, ...) @_ZN1C3addEPKcz(ptr noundef nonnull align 8 dereferenceable(28) undef, ptr noundef %1, ...)
23  ret void
24}
25
26define void @tailTest(ptr %0, ptr %1, ...) unnamed_addr #0 align 2 {
27  tail call void (ptr, ptr, ...) @_ZN1C3addEPKcz(ptr noundef nonnull align 8 dereferenceable(28) undef, ptr noundef %1)
28  ret void
29}
30
31declare void @_ZN1C1fEiiiiiiiiiz(ptr %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 noundef %9, ...) unnamed_addr #1 align 2
32
33define void @_ZThn8_N1C1fEiiiiiiiiiz(ptr %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6, i32 %7, i32 %8, i32 noundef %9, ...) unnamed_addr #1 align 2 {
34  musttail call void (ptr, i32, i32, i32, i32, i32, i32, i32, i32, i32, ...) @_ZN1C1fEiiiiiiiiiz(ptr nonnull align 8 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 undef, i32 noundef %9, ...)
35  ret void
36}
37