// This test checks that BOLT does not split remember and restore CFI states
// into different lists, which would cause an assertion failure.

# RUN: llvm-mc -filetype=obj -triple aarch64-unknown-unknown %s -o %t.o
# RUN: %clang %cflags %t.o -o %t.exe -Wl,-q
# RUN: llvm-bolt %t.exe -o %t.bolt 2>&1 | FileCheck %s

# CHECK: BOLT-INFO: Starting stub-insertion pass

.text
.global main
.type main, %function

main:
.cfi_startproc
.cfi_remember_state
  mov	w0, wzr
  b.ne .L1
.L0:
  mov	w0, wzr
.L1:
  cmp	x0, #0
  b.lt .L2
.L2:
  nop
  .cfi_restore_state
  mov	x8, xzr
  b.ls .L0
  ret
.cfi_endproc
    .size main, .-main

## Force relocation mode.
  .reloc 0, R_AARCH64_NONE
