1*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -skip-partial-inlining-cost-analysis -S | FileCheck %s
2*cee313d2SEric Christopher
3*cee313d2SEric Christopher; This test checks to make sure that the CodeExtractor
4*cee313d2SEric Christopher;  properly sets the entry count for the function that is
5*cee313d2SEric Christopher;  extracted based on the root block being extracted and also
6*cee313d2SEric Christopher;  takes into consideration if the block has edges coming from
7*cee313d2SEric Christopher;  a block that is also being extracted.
8*cee313d2SEric Christopher
9*cee313d2SEric Christopherdefine i32 @inlinedFunc(i1 %cond) !prof !1 {
10*cee313d2SEric Christopherentry:
11*cee313d2SEric Christopher  br i1 %cond, label %if.then, label %return, !prof !2
12*cee313d2SEric Christopherif.then:
13*cee313d2SEric Christopher  br i1 %cond, label %if.then, label %return, !prof !3
14*cee313d2SEric Christopherreturn:             ; preds = %entry
15*cee313d2SEric Christopher  ret i32 0
16*cee313d2SEric Christopher}
17*cee313d2SEric Christopher
18*cee313d2SEric Christopher
19*cee313d2SEric Christopherdefine internal i32 @dummyCaller(i1 %cond) !prof !1 {
20*cee313d2SEric Christopherentry:
21*cee313d2SEric Christopher  %val = call i32 @inlinedFunc(i1 %cond)
22*cee313d2SEric Christopher  ret i32 %val
23*cee313d2SEric Christopher}
24*cee313d2SEric Christopher
25*cee313d2SEric Christopher; CHECK: @inlinedFunc.1.if.then(i1 %cond) !prof [[COUNT1:![0-9]+]]
26*cee313d2SEric Christopher
27*cee313d2SEric Christopher
28*cee313d2SEric Christopher!llvm.module.flags = !{!0}
29*cee313d2SEric Christopher; CHECK: [[COUNT1]] = !{!"function_entry_count", i64 250}
30*cee313d2SEric Christopher!0 = !{i32 1, !"MaxFunctionCount", i32 1000}
31*cee313d2SEric Christopher!1 = !{!"function_entry_count", i64 1000}
32*cee313d2SEric Christopher!2 = !{!"branch_weights", i32 250, i32 750}
33*cee313d2SEric Christopher!3 = !{!"branch_weights", i32 125, i32 125}
34