1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
2 ; RUN: llc --force-dwarf-frame-section %s -o - | FileCheck %s
3 ; RUN: llc --filetype=obj %s -o - | llvm-readelf -u - | FileCheck %s --check-prefix=UNWIND
4 target datalayout = "e-m:e-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
5 target triple = "thumbv8.1m.main-arm-unknown-eabi"
7 ; Check the function starts with `pacbti` and correct unwind info is emitted
8 define hidden i32 @_Z1fi(i32 %x) "sign-return-address"="non-leaf" "sign-return-address-key"="a_key" "branch-target-enforcement" {
10 ; CHECK: .cfi_sections .debug_frame
11 ; CHECK-NEXT: .cfi_startproc
12 ; CHECK-NEXT: @ %bb.0: @ %entry
13 ; CHECK-NEXT: pacbti r12, lr, sp
14 ; CHECK-NEXT: .save {r7, ra_auth_code, lr}
15 ; CHECK-NEXT: push.w {r7, r12, lr}
16 ; CHECK-NEXT: .cfi_def_cfa_offset 12
17 ; CHECK-NEXT: .cfi_offset lr, -4
18 ; CHECK-NEXT: .cfi_offset ra_auth_code, -8
19 ; CHECK-NEXT: .cfi_offset r7, -12
21 ; CHECK-NEXT: sub sp, #4
22 ; CHECK-NEXT: .cfi_def_cfa_offset 16
23 ; CHECK-NEXT: adds r0, #1
24 ; CHECK-NEXT: bl _Z1gi
25 ; CHECK-NEXT: subs r0, #1
26 ; CHECK-NEXT: add sp, #4
27 ; CHECK-NEXT: pop.w {r7, r12, lr}
28 ; CHECK-NEXT: aut r12, lr, sp
31 %add = add nsw i32 %x, 1
32 %call = tail call i32 @_Z1gi(i32 %add)
33 %sub = add nsw i32 %call, -1
37 declare dso_local i32 @_Z1gi(i32)
39 ; UNWIND-LABEL: Opcodes [
40 ; UNWIND-NEXT: 0x00 ; vsp = vsp + 4
41 ; UNWIND-NEXT: 0x80 0x08 ; pop {r7}
42 ; UNWIND-NEXT: 0xB4 ; pop ra_auth_code
43 ; UNWIND-NEXT: 0x84 0x00 ; pop {lr}