Home | History | Annotate | Download | only in Inline
      1 ; RUN: opt -S -always-inline < %s | FileCheck %s
      2 
      3 declare void @llvm.experimental.guard(i1, ...)
      4 
      5 define i8 @callee(i1* %c_ptr) alwaysinline {
      6   %c = load volatile i1, i1* %c_ptr
      7   call void(i1, ...) @llvm.experimental.guard(i1 %c, i32 1) [ "deopt"(i32 1) ]
      8   ret i8 5
      9 }
     10 
     11 define void @caller_0(i1* %c, i8* %ptr) {
     12 ; CHECK-LABEL: @caller_0(
     13 entry:
     14 ; CHECK:  [[COND:%[^ ]+]] = load volatile i1, i1* %c
     15 ; CHECK-NEXT:  call void (i1, ...) @llvm.experimental.guard(i1 [[COND]], i32 1) [ "deopt"(i32 2, i32 1) ]
     16 ; CHECK-NEXT:  store i8 5, i8* %ptr
     17 
     18   %v = call i8 @callee(i1* %c)  [ "deopt"(i32 2) ]
     19   store i8 %v, i8* %ptr
     20   ret void
     21 }
     22 
     23 define i32 @caller_1(i1* %c, i8* %ptr) personality i8 3 {
     24 ; CHECK-LABEL: @caller_1(
     25 ; CHECK:  [[COND:%[^ ]+]] = load volatile i1, i1* %c
     26 ; CHECK-NEXT:  call void (i1, ...) @llvm.experimental.guard(i1 [[COND]], i32 1) [ "deopt"(i32 3, i32 1) ]
     27 ; CHECK-NEXT:  br label %normal
     28 entry:
     29   %v = invoke i8 @callee(i1* %c)  [ "deopt"(i32 3) ] to label %normal
     30        unwind label %unwind
     31 
     32 unwind:
     33   %lp = landingpad i32 cleanup
     34   ret i32 43
     35 
     36 normal:
     37   store i8 %v, i8* %ptr
     38   ret i32 42
     39 }
     40