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