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 4 @env = global [64 x i32] zeroinitializer, align 4 5 6 define void @f(i32 %b) safestack { 7 entry: 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 13 14 %call = call i32 @setjmp(i32* getelementptr inbounds ([64 x i32], [64 x i32]* @env, i32 0, i32 0)) returns_twice 15 16 ; CHECK: %[[USP2:.*]] = load i8*, i8** %[[USDP]] 17 ; CHECK: store i8* %[[USP2]], i8** %[[SPA]] 18 19 %tobool = icmp eq i32 %b, 0 20 br i1 %tobool, label %if.end, label %if.then 21 22 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) 26 br label %if.end 27 28 if.end: 29 ; CHECK: store i8* %[[USP:.*]], i8** %[[SPA:.*]] 30 31 ret void 32 } 33 34 declare i32 @setjmp(i32*) returns_twice 35 36 declare void @_Z7CapturePv(i8*) 37