1*cee313d2SEric Christopher; RUN: opt < %s -skip-partial-inlining-cost-analysis -partial-inliner -S  | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt < %s -skip-partial-inlining-cost-analysis -passes=partial-inliner -S  | FileCheck %s
3*cee313d2SEric Christopher
4*cee313d2SEric Christopherdefine i32 @Func(i1 %cond, i32* align 4 %align.val) !prof !1 {
5*cee313d2SEric Christopher; CHECK: @Func({{.*}}) !prof [[REMAINCOUNT:![0-9]+]]
6*cee313d2SEric Christopherentry:
7*cee313d2SEric Christopher  br i1 %cond, label %if.then, label %return
8*cee313d2SEric Christopherif.then:
9*cee313d2SEric Christopher  ; Dummy store to have more than 0 uses
10*cee313d2SEric Christopher  store i32 10, i32* %align.val, align 4
11*cee313d2SEric Christopher  br label %return
12*cee313d2SEric Christopherreturn:             ; preds = %entry
13*cee313d2SEric Christopher  ret i32 0
14*cee313d2SEric Christopher}
15*cee313d2SEric Christopher
16*cee313d2SEric Christopherdefine internal i32 @Caller1(i1 %cond, i32* align 2 %align.val) !prof !3{
17*cee313d2SEric Christopherentry:
18*cee313d2SEric Christopher; CHECK-LABEL: @Caller1
19*cee313d2SEric Christopher; CHECK: br
20*cee313d2SEric Christopher; CHECK: call void @Func.1.
21*cee313d2SEric Christopher; CHECK: br
22*cee313d2SEric Christopher; CHECK: call void @Func.1.
23*cee313d2SEric Christopher  %val = call i32 @Func(i1 %cond, i32* %align.val)
24*cee313d2SEric Christopher  %val2 = call i32 @Func(i1 %cond, i32* %align.val)
25*cee313d2SEric Christopher  ret i32 %val
26*cee313d2SEric Christopher}
27*cee313d2SEric Christopher
28*cee313d2SEric Christopherdefine internal i32 @Caller2(i1 %cond, i32* align 2 %align.val) !prof !2{
29*cee313d2SEric Christopherentry:
30*cee313d2SEric Christopher; CHECK-LABEL: @Caller2
31*cee313d2SEric Christopher; CHECK: br
32*cee313d2SEric Christopher; CHECK: call void @Func.1.
33*cee313d2SEric Christopher  %val = call i32 @Func(i1 %cond, i32* %align.val)
34*cee313d2SEric Christopher  ret i32 %val
35*cee313d2SEric Christopher}
36*cee313d2SEric Christopher
37*cee313d2SEric Christopher; CHECK: [[REMAINCOUNT]] = !{!"function_entry_count", i64 150}
38*cee313d2SEric Christopher!1 = !{!"function_entry_count", i64 200}
39*cee313d2SEric Christopher!2 = !{!"function_entry_count", i64 10}
40*cee313d2SEric Christopher!3 = !{!"function_entry_count", i64 20}
41*cee313d2SEric Christopher
42