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