1 ; RUN: llc < %s -mtriple=arm64-apple-ios -relocation-model=pic | FileCheck %s 2 3 @__stack_chk_guard = external global i64* 4 5 ; PR20558 6 7 ; CHECK: adrp [[R0:x[0-9]+]], ___stack_chk_guard@GOTPAGE 8 ; CHECK: ldr [[R1:x[0-9]+]], {{\[}}[[R0]], ___stack_chk_guard@GOTPAGEOFF{{\]}} 9 ; CHECK: ldr [[R2:x[0-9]+]], {{\[}}[[R1]]{{\]}} 10 ; CHECK: stur [[R2]], {{\[}}x29, [[SLOT0:[0-9#\-]+]]{{\]}} 11 ; CHECK: ldur [[R3:x[0-9]+]], {{\[}}x29, [[SLOT0]]{{\]}} 12 ; CHECK: sub [[R4:x[0-9]+]], [[R2]], [[R3]] 13 ; CHECK: cbnz [[R4]], LBB 14 15 define i32 @test_stack_guard_remat2() { 16 entry: 17 %StackGuardSlot = alloca i8* 18 %StackGuard = load i8*, i8** bitcast (i64** @__stack_chk_guard to i8**) 19 call void @llvm.stackprotector(i8* %StackGuard, i8** %StackGuardSlot) 20 %container = alloca [32 x i8], align 1 21 call void @llvm.stackprotectorcheck(i8** bitcast (i64** @__stack_chk_guard to i8**)) 22 ret i32 -1 23 } 24 25 declare void @llvm.stackprotector(i8*, i8**) 26 declare void @llvm.stackprotectorcheck(i8**) 27