1 ; RUN: llc --force-dwarf-frame-section %s -o - | FileCheck %s
2 ; RUN: llc --filetype=obj %s -o - | llvm-readelf --unwind - | FileCheck %s --check-prefix=UNWIND
3 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
4 target triple = "thumbv8.1m.main-arm-none-eabi"
9 ; __attribute__((aligned(32))) int a[4];
12 ; for (int i = 0; i < 4; ++i)
17 define hidden i32 @_Z1fv() local_unnamed_addr {
19 %a = alloca [4 x i32], align 32
20 %call = call i32 @_Z1giPi(i32 4, ptr nonnull %a)
21 %0 = load i32, ptr %a, align 32
22 %arrayidx.1 = getelementptr inbounds [4 x i32], ptr %a, i32 0, i32 1
23 %1 = load i32, ptr %arrayidx.1, align 4
24 %add.1 = add nsw i32 %1, %0
25 %arrayidx.2 = getelementptr inbounds [4 x i32], ptr %a, i32 0, i32 2
26 %2 = load i32, ptr %arrayidx.2, align 8
27 %add.2 = add nsw i32 %2, %add.1
28 %arrayidx.3 = getelementptr inbounds [4 x i32], ptr %a, i32 0, i32 3
29 %3 = load i32, ptr %arrayidx.3, align 4
30 %add.3 = add nsw i32 %3, %add.2
35 ; CHECK: pac r12, lr, sp
36 ; CHECK: .save {r4, r6, r7, lr}
37 ; CHECK-NEXT: push {r4, r6, r7, lr}
38 ; CHECK-NEXT: .cfi_def_cfa_offset 16
39 ; CHECK-NEXT: .cfi_offset lr, -4
40 ; CHECK-NEXT: .cfi_offset r7, -8
41 ; CHECK-NEXT: .cfi_offset r6, -12
42 ; CHECK-NEXT: .cfi_offset r4, -16
43 ; CHECK-NEXT: .setfp r7, sp, #8
44 ; CHECK-NEXT: add r7, sp, #8
45 ; CHECK-NEXT: .cfi_def_cfa r7, 8
46 ; CHECK-NEXT: .save {ra_auth_code}
47 ; CHECK-NEXT: str r12, [sp, #-4]!
48 ; CHECK-NEXT: .cfi_offset ra_auth_code, -20
49 ; CHECK-NEXT: .pad #44
50 ; CHECK-NEXT: sub sp, #44
51 ; CHECK: ldr r12, [sp], #4
52 ; CHECK-NEXT: pop.w {r4, r6, r7, lr}
53 ; CHECK-NEXT: aut r12, lr, sp
57 declare dso_local i32 @_Z1giPi(i32, ptr) local_unnamed_addr
59 !llvm.module.flags = !{!0, !1, !2}
61 !0 = !{i32 8, !"branch-target-enforcement", i32 0}
62 !1 = !{i32 8, !"sign-return-address", i32 1}
63 !2 = !{i32 8, !"sign-return-address-all", i32 0}
65 ; UNWIND-LABEL: FunctionAddress: 0x0
66 ; UNWIND: 0x97 ; vsp = r7
67 ; UNWIND: 0x42 ; vsp = vsp - 12
68 ; UNWIND: 0xB4 ; pop ra_auth_code
69 ; UNWIND: 0x84 0x0D ; pop {r4, r6, r7, lr}