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
3 ; RUN: opt -passes=safe-stack -S -mtriple=arm-linux-androideabi < %s -o - | FileCheck %s
5 @env = global [64 x i32] zeroinitializer, align 4
7 define void @f(i32 %b) safestack {
9 ; CHECK: %[[SPA:.*]] = call ptr @__safestack_pointer_address()
10 ; CHECK: %[[USP:.*]] = load ptr, ptr %[[SPA]]
11 ; CHECK: %[[USDP:.*]] = alloca ptr
12 ; CHECK: store ptr %[[USP]], ptr %[[USDP]]
13 ; CHECK: call i32 @setjmp
15 %call = call i32 @setjmp(ptr @env) returns_twice
17 ; CHECK: %[[USP2:.*]] = load ptr, ptr %[[USDP]]
18 ; CHECK: store ptr %[[USP2]], ptr %[[SPA]]
20 %tobool = icmp eq i32 %b, 0
21 br i1 %tobool, label %if.end, label %if.then
24 %0 = alloca [42 x i8], align 1
25 call void @_Z7CapturePv(ptr %0)
29 ; CHECK: store ptr %[[USP:.*]], ptr %[[SPA:.*]]
34 declare i32 @setjmp(ptr) returns_twice
36 declare void @_Z7CapturePv(ptr)