llvm-project
67 строк · 2.0 Кб
1; RUN: opt < %s -passes=partial-inliner -S | FileCheck %s
2; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=3 -skip-partial-inlining-cost-analysis -S | FileCheck --check-prefix=LIMIT3 %s
3; RUN: opt < %s -passes=partial-inliner -max-num-inline-blocks=2 -S | FileCheck --check-prefix=LIMIT2 %s
4
5
6; Function Attrs: nounwind uwtable
7define i32 @bar(i32 %arg) local_unnamed_addr #0 {
8bb:
9%tmp = icmp slt i32 %arg, 0
10br i1 %tmp, label %bb4, label %bb1
11
12bb1: ; preds = %bb
13%tmp2 = tail call i32 (...) @n() #2
14%tmp3 = icmp slt i32 %tmp2, %arg
15br i1 %tmp3, label %bb4, label %bb8
16
17bb4: ; preds = %bb1, %bb
18%tmp5 = tail call i32 (...) @m() #2
19%tmp6 = icmp sgt i32 %tmp5, %arg
20br i1 %tmp6, label %bb7, label %bb8
21
22bb7: ; preds = %bb4
23tail call void (...) @foo() #2
24tail call void (...) @foo() #2
25tail call void (...) @foo() #2
26tail call void (...) @foo() #2
27tail call void (...) @foo() #2
28tail call void (...) @foo() #2
29tail call void (...) @foo() #2
30tail call void (...) @foo() #2
31tail call void (...) @foo() #2
32br label %bb8
33
34bb8: ; preds = %bb7, %bb4, %bb1
35%tmp9 = phi i32 [ 0, %bb7 ], [ 1, %bb4 ], [ 1, %bb1 ]
36ret i32 %tmp9
37}
38
39declare i32 @n(...) local_unnamed_addr #1
40
41declare i32 @m(...) local_unnamed_addr #1
42
43declare void @foo(...) local_unnamed_addr #1
44
45; Function Attrs: nounwind uwtable
46define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
47bb:
48; CHECK-LABEL: @dummy_caller
49; CHECK: br i1
50; CHECK: br i1
51; CHECK: br i1
52; CHECK: call void @bar.1.
53; LIMIT3-LABEL: @dummy_caller
54; LIMIT3: br i1
55; LIMIT3: br i1
56; LIMIT3-NOT: br i1
57; LIMIT3: call void @bar.1.
58; LIMIT2-LABEL: @dummy_caller
59; LIMIT2-NOT: br i1
60; LIMIT2: call i32 @bar(
61%tmp = tail call i32 @bar(i32 %arg)
62ret i32 %tmp
63}
64
65attributes #0 = { nounwind }
66attributes #1 = { nounwind }
67attributes #2 = { nounwind }
68
69