blob: 4465a0fd485209961b5ac180e10b58a4185760e8 [file] [log] [blame]
Eric Christophercee313d2019-04-17 04:52:47 +00001; RUN: opt < %s -partial-inliner -S | FileCheck %s
2; RUN: opt < %s -passes=partial-inliner -S | FileCheck %s
3
4
5; Function Attrs: nounwind
6declare void @foo(...) local_unnamed_addr #0
7
8; Function Attrs: noinline
9define i32 @caller(i32 (i32)* nocapture %arg, i32 (i32)* nocapture %arg1, i32 %arg2) local_unnamed_addr #1 {
10bb:
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
14 ret i32 %tmp4
15}
16
17; Function Attrs: nounwind
18define i32 @bar(i32 %arg) #0 {
19bb:
20 %tmp = icmp slt i32 %arg, 0
21 br i1 %tmp, label %bb1, label %bb2
22
23bb1: ; preds = %bb
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
33 br label %bb2
34
35bb2: ; preds = %bb1, %bb
36 %tmp3 = phi i32 [ 0, %bb1 ], [ 1, %bb ]
37 ret i32 %tmp3
38}
39
40; Function Attrs: nounwind
41define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
42bb:
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)
48 ret i32 %tmp
49}
50
51attributes #0 = { nounwind }
52attributes #1 = { noinline }
53
54!llvm.ident = !{!0}
55
56!0 = !{!"clang version 5.0.0 (trunk 300897) (llvm/trunk 300947)"}