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
4@.str = private unnamed_addr constant [4 x i8] c"%s\0A\00", align 1
5
6; Addr-of in phi instruction
7; Requires protector.
8define void @foo() nounwind uwtable safestack {
9entry:
10  ; CHECK: __safestack_unsafe_stack_ptr
11  %x = alloca double, align 8
12  %call = call double @testi_aux() nounwind
13  store double %call, double* %x, align 8
14  %cmp = fcmp ogt double %call, 3.140000e+00
15  br i1 %cmp, label %if.then, label %if.else
16
17if.then:                                          ; preds = %entry
18  %call1 = call double @testi_aux() nounwind
19  store double %call1, double* %x, align 8
20  br label %if.end4
21
22if.else:                                          ; preds = %entry
23  %cmp2 = fcmp ogt double %call, 1.000000e+00
24  br i1 %cmp2, label %if.then3, label %if.end4
25
26if.then3:                                         ; preds = %if.else
27  br label %if.end4
28
29if.end4:                                          ; preds = %if.else, %if.then3, %if.then
30  %y.0 = phi double* [ null, %if.then ], [ %x, %if.then3 ], [ null, %if.else ]
31  %call5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %y.0) nounwind
32  ret void
33}
34
35declare double @testi_aux()
36declare i32 @printf(i8*, ...)
37