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 i64*
8 define i32 @test_stack_guard_remat2() ssp {
9 ; CHECK-LABEL: test_stack_guard_remat2:
10 ; CHECK: ; %bb.0: ; %entry
11 ; CHECK-NEXT: sub sp, sp, #64
12 ; CHECK-NEXT: stp x29, x30, [sp, #48] ; 16-byte Folded Spill
13 ; CHECK-NEXT: add x29, sp, #48
14 ; CHECK-NEXT: .cfi_def_cfa w29, 16
15 ; CHECK-NEXT: .cfi_offset w30, -8
16 ; CHECK-NEXT: .cfi_offset w29, -16
18 ; CHECK-NEXT: adrp x8, ___stack_chk_guard@GOTPAGE
20 ; Load the stack guard for the second time, just in case the previous value gets spilled.
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]
33 ; CHECK-NEXT: adrp x9, ___stack_chk_guard@GOTPAGE
34 ; CHECK-NEXT: ldur x8, [x29, #-8]
36 ; CHECK-NEXT: ldr x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
38 ; CHECK-NEXT: ldr x9, [x9]
39 ; CHECK-NEXT: cmp x9, x8
40 ; CHECK-NEXT: b.ne LBB0_2
41 ; CHECK-NEXT: ; %bb.1: ; %entry
42 ; CHECK-NEXT: ldp x29, x30, [sp, #48] ; 16-byte Folded Reload
43 ; CHECK-NEXT: mov w0, #-1
44 ; CHECK-NEXT: add sp, sp, #64
46 ; CHECK-NEXT: LBB0_2: ; %entry
47 ; CHECK-NEXT: bl ___stack_chk_fail
48 ; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh6, Lloh7, Lloh8
49 ; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh1, Lloh3, Lloh5
50 ; CHECK-NEXT: .loh AdrpLdrGotLdr Lloh0, Lloh2, Lloh4
52 %StackGuardSlot = alloca i8*
53 %StackGuard = load i8*, i8** bitcast (i64** @__stack_chk_guard to i8**)
54 call void @llvm.stackprotector(i8* %StackGuard, i8** %StackGuardSlot)
55 %container = alloca [32 x i8], align 1
56 call void @llvm.stackprotectorcheck(i8** bitcast (i64** @__stack_chk_guard to i8**))
60 declare void @llvm.stackprotector(i8*, i8**) ssp
61 declare void @llvm.stackprotectorcheck(i8**) ssp