1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -frame-pointer=all -mtriple=arm64-windows | FileCheck %s
4 ; Test generated from C code:
7 ; return _AddressOfReturnAddress();
9 ; int bar(int x(va_list, ptr), ...) {
12 ; return x(y, _AddressOfReturnAddress()) + 1;
15 declare void @llvm.va_start(ptr)
16 declare ptr @llvm.addressofreturnaddress()
18 define dso_local ptr @"foo"() {
20 ; CHECK: .seh_proc foo
21 ; CHECK-NEXT: // %bb.0: // %entry
22 ; CHECK-NEXT: stp x29, x30, [sp, #-16]! // 16-byte Folded Spill
23 ; CHECK-NEXT: .seh_save_fplr_x 16
24 ; CHECK-NEXT: mov x29, sp
25 ; CHECK-NEXT: .seh_set_fp
26 ; CHECK-NEXT: .seh_endprologue
27 ; CHECK-NEXT: add x0, x29, #8
28 ; CHECK-NEXT: .seh_startepilogue
29 ; CHECK-NEXT: ldp x29, x30, [sp], #16 // 16-byte Folded Reload
30 ; CHECK-NEXT: .seh_save_fplr_x 16
31 ; CHECK-NEXT: .seh_endepilogue
33 ; CHECK-NEXT: .seh_endfunclet
34 ; CHECK-NEXT: .seh_endproc
36 %0 = call ptr @llvm.addressofreturnaddress()
40 define dso_local i32 @"bar"(ptr %x, ...) {
42 ; CHECK: .seh_proc bar
43 ; CHECK-NEXT: // %bb.0: // %entry
44 ; CHECK-NEXT: sub sp, sp, #96
45 ; CHECK-NEXT: .seh_stackalloc 96
46 ; CHECK-NEXT: stp x29, x30, [sp, #16] // 16-byte Folded Spill
47 ; CHECK-NEXT: .seh_save_fplr 16
48 ; CHECK-NEXT: add x29, sp, #16
49 ; CHECK-NEXT: .seh_add_fp 16
50 ; CHECK-NEXT: .seh_endprologue
51 ; CHECK-NEXT: add x9, x29, #24
52 ; CHECK-NEXT: mov x8, x0
53 ; CHECK-NEXT: stp x1, x2, [x29, #24]
54 ; CHECK-NEXT: stp x9, x0, [sp]
55 ; CHECK-NEXT: add x0, x29, #24
56 ; CHECK-NEXT: add x1, x29, #8
57 ; CHECK-NEXT: stp x3, x4, [x29, #40]
58 ; CHECK-NEXT: stp x5, x6, [x29, #56]
59 ; CHECK-NEXT: str x7, [x29, #72]
61 ; CHECK-NEXT: add w0, w0, #1
62 ; CHECK-NEXT: .seh_startepilogue
63 ; CHECK-NEXT: ldp x29, x30, [sp, #16] // 16-byte Folded Reload
64 ; CHECK-NEXT: .seh_save_fplr 16
65 ; CHECK-NEXT: add sp, sp, #96
66 ; CHECK-NEXT: .seh_stackalloc 96
67 ; CHECK-NEXT: .seh_endepilogue
69 ; CHECK-NEXT: .seh_endfunclet
70 ; CHECK-NEXT: .seh_endproc
72 %x.addr = alloca ptr, align 8
73 %y = alloca ptr, align 8
74 store ptr %x, ptr %x.addr, align 8
75 call void @llvm.va_start(ptr %y)
76 %0 = load ptr, ptr %x.addr, align 8
77 %1 = call ptr @llvm.addressofreturnaddress()
78 %2 = load ptr, ptr %y, align 8
79 %call = call i32 %0(ptr %2, ptr %1)
80 %add = add nsw i32 %call, 1