1*cee313d2SEric Christopher; RUN: opt < %s -partial-inliner -S  | FileCheck %s
2*cee313d2SEric Christopher; RUN: opt < %s -passes=partial-inliner -S  | FileCheck %s
3*cee313d2SEric Christopher
4*cee313d2SEric Christopher
5*cee313d2SEric Christopher; Function Attrs: nounwind
6*cee313d2SEric Christopherdeclare void @foo(...) local_unnamed_addr #0
7*cee313d2SEric Christopher
8*cee313d2SEric Christopher; Function Attrs: noinline
9*cee313d2SEric Christopherdefine i32 @caller(i32 (i32)* nocapture %arg, i32 (i32)* nocapture %arg1, i32 %arg2) local_unnamed_addr #1 {
10*cee313d2SEric Christopherbb:
11*cee313d2SEric Christopher  %tmp = tail call i32 %arg(i32 %arg2) #0
12*cee313d2SEric Christopher  %tmp3 = tail call i32 %arg1(i32 %arg2) #0
13*cee313d2SEric Christopher  %tmp4 = add nsw i32 %tmp3, %tmp
14*cee313d2SEric Christopher  ret i32 %tmp4
15*cee313d2SEric Christopher}
16*cee313d2SEric Christopher
17*cee313d2SEric Christopher; Function Attrs: nounwind
18*cee313d2SEric Christopherdefine i32 @bar(i32 %arg) #0 {
19*cee313d2SEric Christopherbb:
20*cee313d2SEric Christopher  %tmp = icmp slt i32 %arg, 0
21*cee313d2SEric Christopher  br i1 %tmp, label %bb1, label %bb2
22*cee313d2SEric Christopher
23*cee313d2SEric Christopherbb1:                                              ; preds = %bb
24*cee313d2SEric Christopher  tail call void (...) @foo() #0
25*cee313d2SEric Christopher  tail call void (...) @foo() #0
26*cee313d2SEric Christopher  tail call void (...) @foo() #0
27*cee313d2SEric Christopher  tail call void (...) @foo() #0
28*cee313d2SEric Christopher  tail call void (...) @foo() #0
29*cee313d2SEric Christopher  tail call void (...) @foo() #0
30*cee313d2SEric Christopher  tail call void (...) @foo() #0
31*cee313d2SEric Christopher  tail call void (...) @foo() #0
32*cee313d2SEric Christopher  tail call void (...) @foo() #0
33*cee313d2SEric Christopher  br label %bb2
34*cee313d2SEric Christopher
35*cee313d2SEric Christopherbb2:                                              ; preds = %bb1, %bb
36*cee313d2SEric Christopher  %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
37*cee313d2SEric Christopher  ret i32 %tmp3
38*cee313d2SEric Christopher}
39*cee313d2SEric Christopher
40*cee313d2SEric Christopher; Function Attrs: nounwind
41*cee313d2SEric Christopherdefine i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
42*cee313d2SEric Christopherbb:
43*cee313d2SEric Christopher; CHECK-LABEL: @dummy_caller
44*cee313d2SEric Christopher; check that caller is not wrongly inlined by partial inliner
45*cee313d2SEric Christopher; CHECK: call i32 @caller
46*cee313d2SEric Christopher; CHECK-NOT: call .* @bar
47*cee313d2SEric Christopher  %tmp = tail call i32 @caller(i32 (i32)* nonnull @bar, i32 (i32)* nonnull @bar, i32 %arg)
48*cee313d2SEric Christopher  ret i32 %tmp
49*cee313d2SEric Christopher}
50*cee313d2SEric Christopher
51*cee313d2SEric Christopherattributes #0 = { nounwind }
52*cee313d2SEric Christopherattributes #1 = { noinline }
53*cee313d2SEric Christopher
54*cee313d2SEric Christopher!llvm.ident = !{!0}
55*cee313d2SEric Christopher
56*cee313d2SEric Christopher!0 = !{!"clang version 5.0.0 (trunk 300897) (llvm/trunk 300947)"}
57