llvm/llvm/test/CodeGen/X86/stack-protector-recursively.ll

; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mtriple=x86_64-pc-linux-gnu -o - < %s | FileCheck %s

; Make sure the stack protect not infinitly check __stack_chk_fail.
define dso_local void @__stack_chk_fail() local_unnamed_addr #0 {
; CHECK-LABEL: __stack_chk_fail:
; CHECK:       # %bb.0: # %entry
; CHECK-NEXT:    pushq %rax
; CHECK-NEXT:    movq %fs:40, %rax
; CHECK-NEXT:    movq %rax, (%rsp)
; CHECK-NEXT:    movq %fs:40, %rax
; CHECK-NEXT:    cmpq (%rsp), %rax
; CHECK-NEXT:    jne .LBB0_2
; CHECK-NEXT:  # %bb.1: # %SP_return
; CHECK-NEXT:    callq foo@PLT
; CHECK-NEXT:  .LBB0_2: # %CallStackCheckFailBlk
; CHECK-NEXT:    callq __stack_chk_fail
entry:
  tail call void @foo() noreturn
  unreachable
}

declare void @foo() noreturn

attributes #0 = { noreturn nounwind sspreq }