1 ; Test stack pointer restore after setjmp() with the function-call safestack ABI.
2 ; RUN: opt -safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
4 @env = global [64 x i32] zeroinitializer, align 4
6 define void @f(i32 %b) safestack {
8 ; CHECK: %[[SPA:.*]] = call i8** @__safestack_pointer_address()
9 ; CHECK: %[[USP:.*]] = load i8*, i8** %[[SPA]]
10 ; CHECK: %[[USDP:.*]] = alloca i8*
11 ; CHECK: store i8* %[[USP]], i8** %[[USDP]]
12 ; CHECK: call i32 @setjmp
14 %call = call i32 @setjmp(i32* getelementptr inbounds ([64 x i32], [64 x i32]* @env, i32 0, i32 0)) returns_twice
16 ; CHECK: %[[USP2:.*]] = load i8*, i8** %[[USDP]]
17 ; CHECK: store i8* %[[USP2]], i8** %[[SPA]]
19 %tobool = icmp eq i32 %b, 0
20 br i1 %tobool, label %if.end, label %if.then
23 %0 = alloca [42 x i8], align 1
24 %.sub = getelementptr inbounds [42 x i8], [42 x i8]* %0, i32 0, i32 0
25 call void @_Z7CapturePv(i8* %.sub)
29 ; CHECK: store i8* %[[USP:.*]], i8** %[[SPA:.*]]
34 declare i32 @setjmp(i32*) returns_twice
36 declare void @_Z7CapturePv(i8*)