; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs -mtriple=aarch64-pc-windows-msvc %s -o - -global-isel -global-isel-abort=0 | FileCheck %s

; Make sure we correctly fall back to SelectionDAG isel for unsupported stack protectors.

define void @caller() sspreq {
; CHECK-LABEL: caller:
; CHECK:       .seh_proc caller
; CHECK-NEXT:  // %bb.0: // %entry
; CHECK-NEXT:    sub sp, sp, #32
; CHECK-NEXT:    .seh_stackalloc 32
; CHECK-NEXT:    str x30, [sp, #16] // 8-byte Folded Spill
; CHECK-NEXT:    .seh_save_reg x30, 16
; CHECK-NEXT:    .seh_endprologue
; CHECK-NEXT:    adrp x8, __security_cookie
; CHECK-NEXT:    add x0, sp, #4
; CHECK-NEXT:    ldr x8, [x8, :lo12:__security_cookie]
; CHECK-NEXT:    str x8, [sp, #8]
; CHECK-NEXT:    bl callee
; CHECK-NEXT:    ldr x0, [sp, #8]
; CHECK-NEXT:    bl __security_check_cookie
; CHECK-NEXT:    .seh_startepilogue
; CHECK-NEXT:    ldr x30, [sp, #16] // 8-byte Folded Reload
; CHECK-NEXT:    .seh_save_reg x30, 16
; CHECK-NEXT:    add sp, sp, #32
; CHECK-NEXT:    .seh_stackalloc 32
; CHECK-NEXT:    .seh_endepilogue
; CHECK-NEXT:    ret
; CHECK-NEXT:    .seh_endfunclet
; CHECK-NEXT:    .seh_endproc
entry:
  %x = alloca i32, align 4
  %0 = bitcast i32* %x to i8*
  call void @callee(i32* nonnull %x)
  ret void
}

declare void @callee(i32*)
