1 ; RUN: llc --force-dwarf-frame-section %s -o - | FileCheck %s
2 ; RUN: llc --filetype=obj %s -o - | llvm-readelf -u - | 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-unknown-eabi"
6 define hidden i32 @_Z1fi(i32 %x) {
8 %add = add nsw i32 %x, 1
9 %call = tail call i32 @_Z1gi(i32 %add)
10 %sub = add nsw i32 %call, -1
14 declare dso_local i32 @_Z1gi(i32)
16 !llvm.module.flags = !{!0, !1, !2}
17 !0 = !{i32 8, !"branch-target-enforcement", i32 1}
18 !1 = !{i32 8, !"sign-return-address", i32 1}
19 !2 = !{i32 8, !"sign-return-address-all", i32 0}
21 ; Check the function starts with `pacbti` and correct unwind info is emitted
24 ; CHECK: pacbti r12, lr, sp
25 ; CHECK-NEXT: .save {r7, lr}
26 ; CHECK-NEXT: push {r7, lr}
27 ; CHECK-NEXT: .cfi_def_cfa_offset 8
28 ; CHECK-NEXT: .cfi_offset lr, -4
29 ; CHECK-NEXT: .cfi_offset r7, -8
30 ; CHECK-NEXT: .save {ra_auth_code}
31 ; CHECK-NEXT: str r12, [sp, #-4]!
32 ; CHECK-NEXT: .cfi_def_cfa_offset 12
33 ; CHECK-NEXT: .cfi_offset ra_auth_code, -12
35 ; CHECK-NEXT: sub sp, #4
36 ; CHECK-NEXT: .cfi_def_cfa_offset 16
39 ; UNWIND-LABEL: Opcodes [
40 ; UNWIND-NEXT: 0x00 ; vsp = vsp + 4
41 ; UNWIND-NEXT: 0xB4 ; pop ra_auth_code
42 ; UNWIND-NEXT: 0x84 0x08 ; pop {r7, lr}
43 ; UNWIND-NEXT: 0xB0 ; finish