1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=arm64-apple-ios -relocation-model=pic -frame-pointer=all | FileCheck %s
4 @__stack_chk_guard = external global ptr
8 ; Load the stack guard for the second time, just in case the previous value gets spilled.
9 define i32 @test_stack_guard_remat2() ssp {
10 ; CHECK-LABEL: test_stack_guard_remat2:
11 ; CHECK: ; %bb.0: ; %entry
12 ; CHECK-NEXT: sub sp, sp, #64
13 ; CHECK-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
14 ; CHECK-NEXT: add x29, sp, #48
15 ; CHECK-NEXT: .cfi_def_cfa w29, 16
16 ; CHECK-NEXT: .cfi_offset w30, -8
17 ; CHECK-NEXT: .cfi_offset w29, -16
19 ; CHECK-NEXT: adrp x8, ___stack_chk_guard@GOTPAGE
21 ; CHECK-NEXT: adrp x9, ___stack_chk_guard@GOTPAGE
23 ; CHECK-NEXT: ldr x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
25 ; CHECK-NEXT: ldr x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
27 ; CHECK-NEXT: ldr x8, [x8]
29 ; CHECK-NEXT: ldr x9, [x9]
30 ; CHECK-NEXT: str x8, [sp]
31 ; CHECK-NEXT: stur x9, [x29, #-8]
32 ; CHECK-NEXT: ldur x9, [x29, #-8]
33 ; CHECK-NEXT: cmp x8, x9
34 ; CHECK-NEXT: b.ne LBB0_2
35 ; CHECK-NEXT: ; %bb.1: ; %entry
36 ; CHECK-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
37 ; CHECK-NEXT: mov w0, #-1
38 ; CHECK-NEXT: add sp, sp, #64
40 ; CHECK-NEXT: LBB0_2: ; %entry
41 ; CHECK-NEXT: bl ___stack_chk_fail
42 ; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh1, Lloh3, Lloh5
43 ; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh0, Lloh2, Lloh4
45 %StackGuardSlot = alloca ptr
46 %StackGuard = load ptr, ptr @__stack_chk_guard
47 call void @llvm.stackprotector(ptr %StackGuard, ptr %StackGuardSlot)
48 %container = alloca [32 x i8], align 1
49 call void @llvm.stackprotectorcheck(ptr @__stack_chk_guard)
53 declare void @llvm.stackprotector(ptr, ptr) ssp
54 declare void @llvm.stackprotectorcheck(ptr) ssp