Home | History | Annotate | Download | only in Inline
      1 ; RUN: opt -S -inline %s | FileCheck %s
      2 ; RUN: opt -S -passes='cgscc(inline)' %s | FileCheck %s
      3 
      4 declare void @foo()
      5 declare void @bar()
      6 
      7 define void @callee(i8* %arg) {
      8   %cmp = icmp eq i8* %arg, null
      9   br i1 %cmp, label %expensive, label %done
     10 
     11 ; This block is designed to be too expensive to inline.  We can only inline
     12 ; callee if this block is known to be dead.
     13 expensive:
     14   call void @foo()
     15   call void @foo()
     16   call void @foo()
     17   call void @foo()
     18   call void @foo()
     19   call void @foo()
     20   call void @foo()
     21   call void @foo()
     22   call void @foo()
     23   call void @foo()
     24   ret void
     25 
     26 done:
     27   call void @bar()
     28   ret void
     29 }
     30 
     31 ; Positive test - arg is known non null
     32 define void @caller(i8* nonnull %arg) {
     33 ; CHECK-LABEL: @caller
     34 ; CHECK: call void @bar()
     35   call void @callee(i8* nonnull %arg)
     36   ret void
     37 }
     38 
     39 ; Negative test - arg is not known to be non null
     40 define void @caller2(i8* %arg) {
     41 ; CHECK-LABEL: @caller2
     42 ; CHECK: call void @callee(
     43   call void @callee(i8* %arg)
     44   ret void
     45 }
     46 
     47