Home | History | Annotate | Download | only in X86
      1 ; RUN: opt -safe-stack -S -mtriple=x86_64-unknown < %s -o - | FileCheck %s
      2 
      3 define void @foo() safestack sspreq {
      4 entry:
      5 ; CHECK: %[[USP:.*]] = load i8*, i8** @__safestack_unsafe_stack_ptr
      6 ; CHECK: %[[USST:.*]] = getelementptr i8, i8* %[[USP]], i32 -16
      7 ; CHECK: store i8* %[[USST]], i8** @__safestack_unsafe_stack_ptr
      8 
      9 ; CHECK: %[[A:.*]] = getelementptr i8, i8* %[[USP]], i32 -8
     10 ; CHECK: %[[StackGuardSlot:.*]] = bitcast i8* %[[A]] to i8**
     11 ; CHECK: %[[StackGuard:.*]] = load i8*, i8** @__stack_chk_guard
     12 ; CHECK: store i8* %[[StackGuard]], i8** %[[StackGuardSlot]]
     13   %a = alloca i8, align 1
     14 
     15 ; CHECK: call void @Capture
     16   call void @Capture(i8* %a)
     17 
     18 ; CHECK: %[[B:.*]] = load i8*, i8** %[[StackGuardSlot]]
     19 ; CHECK: %[[COND:.*]] = icmp ne i8* %[[StackGuard]], %[[B]]
     20 ; CHECK: br i1 %[[COND]], {{.*}} !prof
     21 
     22 ; CHECK:      call void @__stack_chk_fail()
     23 ; CHECK-NEXT: unreachable
     24 
     25 ; CHECK:      store i8* %[[USP]], i8** @__safestack_unsafe_stack_ptr
     26 ; CHECK-NEXT: ret void
     27   ret void
     28 }
     29 
     30 declare void @Capture(i8*)
     31