1 ; RUN: llc < %s -frame-pointer=all -mtriple=arm64-windows | FileCheck %s
3 ; Test generated from C code:
6 ; return _AddressOfReturnAddress();
8 ; int bar(int x(va_list, ptr), ...) {
11 ; return x(y, _AddressOfReturnAddress()) + 1;
14 declare void @llvm.va_start(ptr)
15 declare ptr @llvm.addressofreturnaddress()
17 define dso_local ptr @"foo"() {
19 %0 = call ptr @llvm.addressofreturnaddress()
23 ; CHECK: stp x29, x30, [sp, #-16]!
25 ; CHECK: add x0, x29, #8
26 ; CHECK: ldp x29, x30, [sp], #16
29 define dso_local i32 @"bar"(ptr %x, ...) {
31 %x.addr = alloca ptr, align 8
32 %y = alloca ptr, align 8
33 store ptr %x, ptr %x.addr, align 8
34 call void @llvm.va_start(ptr %y)
35 %0 = load ptr, ptr %x.addr, align 8
36 %1 = call ptr @llvm.addressofreturnaddress()
37 %2 = load ptr, ptr %y, align 8
38 %call = call i32 %0(ptr %2, ptr %1)
39 %add = add nsw i32 %call, 1
43 ; CHECK: sub sp, sp, #96
44 ; CHECK: stp x29, x30, [sp, #16]
45 ; CHECK: add x29, sp, #16
46 ; CHECK: stp x1, x2, [x29, #24]
47 ; CHECK: add x1, x29, #8
48 ; CHECK: ldp x29, x30, [sp, #16]
49 ; CHECK: add sp, sp, #96