xref: /llvm-project/llvm/test/Transforms/CodeExtractor/PartialInlineLiveAcross.ll (revision bbbbbfbdcb1ab1ba9857138dfa0f2355da8e4499)
1; RUN: opt -S -passes=partial-inliner -max-num-inline-blocks=2 -skip-partial-inlining-cost-analysis < %s  | FileCheck %s
2define i32 @test(i32 %arg) local_unnamed_addr #0 {
3bb:
4  %tmp = tail call i32 (...) @bar() #1
5  %tmp1 = icmp slt i32 %arg, 0
6  br i1 %tmp1, label %bb6, label %bb2
7
8bb2:                                              ; preds = %bb
9  tail call void (...) @foo() #1
10  tail call void (...) @foo() #1
11  tail call void (...) @foo() #1
12  tail call void (...) @foo() #1
13  tail call void (...) @foo() #1
14  %tmp3 = tail call i32 (...) @bar() #1
15  %tmp4 = icmp eq i32 %tmp3, 10
16  br i1 %tmp4, label %bb6, label %bb5
17
18bb5:                                              ; preds = %bb2
19  tail call void (...) @foo() #1
20  tail call void (...) @foo() #1
21  tail call void (...) @foo() #1
22  tail call void (...) @foo() #1
23  br label %bb6
24
25bb6:                                              ; preds = %bb5, %bb2, %bb
26  %tmp7 = phi i32 [ %tmp, %bb5 ], [ 0, %bb ], [ %tmp, %bb2 ]
27  ret i32 %tmp7
28}
29
30declare i32 @bar(...) local_unnamed_addr #1
31
32declare void @foo(...) local_unnamed_addr #1
33
34; Function Attrs: nounwind uwtable
35define i32 @dummy_caller(i32 %arg) local_unnamed_addr #0 {
36; CHECK-LABEL: @dummy_caller
37; CHECK: codeRepl.i:
38; CHECK:  call void @test.1.bb2()
39; CHECK-NOT: load
40; CHECK:  br
41
42bb:
43  %tmp = tail call i32 @test(i32 %arg)
44  ret i32 %tmp
45}
46
47; CHECK-LABEL: define internal void @test.1.bb2()
48; CHECK: .exitStub:
49; CHECK-NOT:  store i32 %tmp7, ptr %tmp7.out
50; CHECK: ret
51
52
53attributes #0 = { nounwind uwtable }
54attributes #1 = { nounwind uwtable }
55
56!llvm.module.flags = !{!0}
57!llvm.ident = !{!1}
58
59!0 = !{i32 1, !"wchar_size", i32 4}
60!1 = !{!"clang version 5.0.0 (trunk 303574)"}
61