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, void*), ...) {
11 ; return x(y, _AddressOfReturnAddress()) + 1;
14 declare void @llvm.va_start(i8*)
15 declare i8* @llvm.addressofreturnaddress()
17 define dso_local i8* @"foo"() {
19 %0 = call i8* @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"(i32 (i8*, i8*)* %x, ...) {
31 %x.addr = alloca i32 (i8*, i8*)*, align 8
32 %y = alloca i8*, align 8
33 store i32 (i8*, i8*)* %x, i32 (i8*, i8*)** %x.addr, align 8
34 %y1 = bitcast i8** %y to i8*
35 call void @llvm.va_start(i8* %y1)
36 %0 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %x.addr, align 8
37 %1 = call i8* @llvm.addressofreturnaddress()
38 %2 = load i8*, i8** %y, align 8
39 %call = call i32 %0(i8* %2, i8* %1)
40 %add = add nsw i32 %call, 1
44 ; CHECK: sub sp, sp, #96
45 ; CHECK: stp x29, x30, [sp, #16]
46 ; CHECK: add x29, sp, #16
47 ; CHECK: stp x1, x2, [x29, #24]
48 ; CHECK: add x1, x29, #8
49 ; CHECK: ldp x29, x30, [sp, #16]
50 ; CHECK: add sp, sp, #96