1 ; RUN: opt < %s -partial-inliner -S | FileCheck %s
2 ; RUN: opt < %s -passes=partial-inliner -S | FileCheck %s
5 ; Function Attrs: nounwind
6 declare void @foo(...) local_unnamed_addr #0
8 ; Function Attrs: noinline
9 define i32 @caller(i32 (i32)* nocapture %arg, i32 (i32)* nocapture %arg1, i32 %arg2) local_unnamed_addr #1 {
11 %tmp = tail call i32 %arg(i32 %arg2) #0
12 %tmp3 = tail call i32 %arg1(i32 %arg2) #0
13 %tmp4 = add nsw i32 %tmp3, %tmp
17 ; Function Attrs: nounwind
18 define i32 @bar(i32 %arg) #0 {
20 %tmp = icmp slt i32 %arg, 0
21 br i1 %tmp, label %bb1, label %bb2
24 tail call void (...) @foo() #0
25 tail call void (...) @foo() #0
26 tail call void (...) @foo() #0
27 tail call void (...) @foo() #0
28 tail call void (...) @foo() #0
29 tail call void (...) @foo() #0
30 tail call void (...) @foo() #0
31 tail call void (...) @foo() #0
32 tail call void (...) @foo() #0
35 bb2: ; preds = %bb1, %bb
36 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
40 ; Function Attrs: nounwind
41 define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
43 ; CHECK-LABEL: @dummy_caller
44 ; check that caller is not wrongly inlined by partial inliner
45 ; CHECK: call i32 @caller
46 ; CHECK-NOT: call .* @bar
47 %tmp = tail call i32 @caller(i32 (i32)* nonnull @bar, i32 (i32)* nonnull @bar, i32 %arg)
51 attributes #0 = { nounwind }
52 attributes #1 = { noinline }
56 !0 = !{!"clang version 5.0.0 (trunk 300897) (llvm/trunk 300947)"}