1 ; RUN: opt -safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
2 ; RUN: opt -safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
4 define void @f(i1 %d1, i1 %d2) safestack {
6 ; CHECK-LABEL: define void @f(
7 ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
8 ; CHECK-NEXT: getelementptr i8, i8* %[[USP]], i32 -16
9 ; CHECK: br i1 %d1, label %[[BB0:.*]], label %[[BB1:.*]]
10 %a = alloca i32, align 8
11 %b = alloca i32, align 8
12 br i1 %d1, label %bb0, label %bb1
16 ; CHECK: %[[Ai8:.*]] = getelementptr i8, i8* %unsafe_stack_ptr, i32
17 ; CHECK: %[[AUNSAFE:.*]] = bitcast i8* %[[Ai8]] to i32*
19 br i1 %d2, label %bb2, label %bb2
23 ; CHECK: %[[Bi8:.*]] = getelementptr i8, i8* %unsafe_stack_ptr, i32
24 ; CHECK: %[[BUNSAFE:.*]] = bitcast i8* %[[Bi8]] to i32*
29 ; CHECK: phi i32* [ %[[AUNSAFE]], %[[BB0]] ], [ %[[AUNSAFE]], %[[BB0]] ], [ %[[BUNSAFE]], %[[BB1]] ]
30 %c = phi i32* [ %a, %bb0 ], [ %a, %bb0 ], [ %b, %bb1 ]
31 call void @capture(i32* %c)
35 declare void @capture(i32*)