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
3 ; RUN: opt -passes=safe-stack -S -mtriple=i386-pc-linux-gnu < %s -o - | FileCheck %s
4 ; RUN: opt -passes=safe-stack -S -mtriple=x86_64-pc-linux-gnu < %s -o - | FileCheck %s
6 define void @f(i1 %d1, i1 %d2) safestack {
8 ; CHECK-LABEL: define void @f(
9 ; CHECK: %[[USP:.*]] = load ptr, ptr @__safestack_unsafe_stack_ptr
10 ; CHECK-NEXT: getelementptr i8, ptr %[[USP]], i32 -16
11 ; CHECK: br i1 %d1, label %[[BB0:.*]], label %[[BB1:.*]]
12 %a = alloca i32, align 8
13 %b = alloca i32, align 8
14 br i1 %d1, label %bb0, label %bb1
18 ; CHECK: %[[Ai8:.*]] = getelementptr i8, ptr %unsafe_stack_ptr, i32
20 br i1 %d2, label %bb2, label %bb2
24 ; CHECK: %[[Bi8:.*]] = getelementptr i8, ptr %unsafe_stack_ptr, i32
29 ; CHECK: phi ptr [ %[[Ai8]], %[[BB0]] ], [ %[[Ai8]], %[[BB0]] ], [ %[[Bi8]], %[[BB1]] ]
30 %c = phi ptr [ %a, %bb0 ], [ %a, %bb0 ], [ %b, %bb1 ]
31 call void @capture(ptr %c)
35 declare void @capture(ptr)