1*cee313d2SEric Christopher; The outlined region has high frequency and the outlining 2*cee313d2SEric Christopher; call sequence is expensive (input, output, multiple exit etc) 3*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -max-num-inline-blocks=2 -S | FileCheck %s 4*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=2 -S | FileCheck %s 5*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -skip-partial-inlining-cost-analysis -max-num-inline-blocks=2 -S | FileCheck --check-prefix=NOCOST %s 6*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -skip-partial-inlining-cost-analysis -max-num-inline-blocks=2 -S | FileCheck --check-prefix=NOCOST %s 7*cee313d2SEric Christopher 8*cee313d2SEric Christopher 9*cee313d2SEric Christopher; Function Attrs: nounwind 10*cee313d2SEric Christopherdefine i32 @bar_hot_outline_region(i32 %arg) local_unnamed_addr #0 { 11*cee313d2SEric Christopherbb: 12*cee313d2SEric Christopher %tmp = icmp slt i32 %arg, 0 13*cee313d2SEric Christopher br i1 %tmp, label %bb1, label %bb16, !prof !1 14*cee313d2SEric Christopher 15*cee313d2SEric Christopherbb1: ; preds = %bb 16*cee313d2SEric Christopher %tmp2 = tail call i32 (...) @foo() #0 17*cee313d2SEric Christopher %tmp3 = tail call i32 (...) @foo() #0 18*cee313d2SEric Christopher %tmp4 = tail call i32 (...) @foo() #0 19*cee313d2SEric Christopher %tmp5 = tail call i32 (...) @foo() #0 20*cee313d2SEric Christopher %tmp6 = tail call i32 (...) @foo() #0 21*cee313d2SEric Christopher %tmp7 = tail call i32 (...) @foo() #0 22*cee313d2SEric Christopher %tmp8 = add nsw i32 %arg, 1 23*cee313d2SEric Christopher %tmp9 = tail call i32 @goo(i32 %tmp8) #0 24*cee313d2SEric Christopher %tmp10 = tail call i32 (...) @foo() #0 25*cee313d2SEric Christopher %tmp11 = icmp eq i32 %tmp10, 0 26*cee313d2SEric Christopher br i1 %tmp11, label %bb12, label %bb16 27*cee313d2SEric Christopher 28*cee313d2SEric Christopherbb12: ; preds = %bb1 29*cee313d2SEric Christopher %tmp13 = tail call i32 (...) @foo() #0 30*cee313d2SEric Christopher %tmp14 = icmp eq i32 %tmp13, 0 31*cee313d2SEric Christopher %tmp15 = select i1 %tmp14, i32 0, i32 3 32*cee313d2SEric Christopher br label %bb16 33*cee313d2SEric Christopher 34*cee313d2SEric Christopherbb16: ; preds = %bb12, %bb1, %bb 35*cee313d2SEric Christopher %tmp17 = phi i32 [ 2, %bb1 ], [ %tmp15, %bb12 ], [ 0, %bb ] 36*cee313d2SEric Christopher ret i32 %tmp17 37*cee313d2SEric Christopher} 38*cee313d2SEric Christopher 39*cee313d2SEric Christopherdefine i32 @bar_cold_outline_region(i32 %arg) local_unnamed_addr #0 { 40*cee313d2SEric Christopherbb: 41*cee313d2SEric Christopher %tmp = icmp slt i32 %arg, 0 42*cee313d2SEric Christopher br i1 %tmp, label %bb1, label %bb16, !prof !2 43*cee313d2SEric Christopher 44*cee313d2SEric Christopherbb1: ; preds = %bb 45*cee313d2SEric Christopher %tmp2 = tail call i32 (...) @foo() #0 46*cee313d2SEric Christopher %tmp3 = tail call i32 (...) @foo() #0 47*cee313d2SEric Christopher %tmp4 = tail call i32 (...) @foo() #0 48*cee313d2SEric Christopher %tmp5 = tail call i32 (...) @foo() #0 49*cee313d2SEric Christopher %tmp6 = tail call i32 (...) @foo() #0 50*cee313d2SEric Christopher %tmp7 = tail call i32 (...) @foo() #0 51*cee313d2SEric Christopher %tmp8 = add nsw i32 %arg, 1 52*cee313d2SEric Christopher %tmp9 = tail call i32 @goo(i32 %tmp8) #0 53*cee313d2SEric Christopher %tmp10 = tail call i32 (...) @foo() #0 54*cee313d2SEric Christopher %tmp11 = icmp eq i32 %tmp10, 0 55*cee313d2SEric Christopher br i1 %tmp11, label %bb12, label %bb16 56*cee313d2SEric Christopher 57*cee313d2SEric Christopherbb12: ; preds = %bb1 58*cee313d2SEric Christopher %tmp13 = tail call i32 (...) @foo() #0 59*cee313d2SEric Christopher %tmp14 = icmp eq i32 %tmp13, 0 60*cee313d2SEric Christopher %tmp15 = select i1 %tmp14, i32 0, i32 3 61*cee313d2SEric Christopher br label %bb16 62*cee313d2SEric Christopher 63*cee313d2SEric Christopherbb16: ; preds = %bb12, %bb1, %bb 64*cee313d2SEric Christopher %tmp17 = phi i32 [ 2, %bb1 ], [ %tmp15, %bb12 ], [ 0, %bb ] 65*cee313d2SEric Christopher ret i32 %tmp17 66*cee313d2SEric Christopher} 67*cee313d2SEric Christopher 68*cee313d2SEric Christopher; Function Attrs: nounwind 69*cee313d2SEric Christopherdeclare i32 @foo(...) local_unnamed_addr #0 70*cee313d2SEric Christopher 71*cee313d2SEric Christopher; Function Attrs: nounwind 72*cee313d2SEric Christopherdeclare i32 @goo(i32) local_unnamed_addr #0 73*cee313d2SEric Christopher 74*cee313d2SEric Christopher; Function Attrs: nounwind 75*cee313d2SEric Christopherdefine i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 { 76*cee313d2SEric Christopherbb: 77*cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller 78*cee313d2SEric Christopher; CHECK-NOT: br i1 79*cee313d2SEric Christopher; CHECK-NOT: call{{.*}}bar_hot_outline_region. 80*cee313d2SEric Christopher; NOCOST-LABEL: @dummy_caller 81*cee313d2SEric Christopher; NOCOST: br i1 82*cee313d2SEric Christopher; NOCOST: call{{.*}}bar_hot_outline_region. 83*cee313d2SEric Christopher 84*cee313d2SEric Christopher %tmp = tail call i32 @bar_hot_outline_region(i32 %arg) 85*cee313d2SEric Christopher ret i32 %tmp 86*cee313d2SEric Christopher} 87*cee313d2SEric Christopher 88*cee313d2SEric Christopherdefine i32 @dummy_caller2(i32 %arg) local_unnamed_addr #0 { 89*cee313d2SEric Christopherbb: 90*cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller2 91*cee313d2SEric Christopher; CHECK: br i1 92*cee313d2SEric Christopher; CHECK: call{{.*}}bar_cold_outline_region. 93*cee313d2SEric Christopher; NOCOST-LABEL: @dummy_caller2 94*cee313d2SEric Christopher; NOCOST: br i1 95*cee313d2SEric Christopher; NOCOST: call{{.*}}bar_cold_outline_region. 96*cee313d2SEric Christopher 97*cee313d2SEric Christopher %tmp = tail call i32 @bar_cold_outline_region(i32 %arg) 98*cee313d2SEric Christopher ret i32 %tmp 99*cee313d2SEric Christopher} 100*cee313d2SEric Christopher 101*cee313d2SEric Christopherattributes #0 = { nounwind } 102*cee313d2SEric Christopher 103*cee313d2SEric Christopher!llvm.ident = !{!0} 104*cee313d2SEric Christopher 105*cee313d2SEric Christopher!0 = !{!"clang version 5.0.0 (trunk 301898)"} 106*cee313d2SEric Christopher!1 = !{!"branch_weights", i32 2000, i32 1} 107*cee313d2SEric Christopher!2 = !{!"branch_weights", i32 1, i32 100} 108