Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -skip-partial-inlining-cost-analysis -partial-inliner -S | FileCheck %s |
| 2 | ; RUN: opt < %s -skip-partial-inlining-cost-analysis -passes=partial-inliner -S | FileCheck %s |
| 3 | |
| 4 | define i32 @Func(i1 %cond, i32* align 4 %align.val) !prof !1 { |
| 5 | ; CHECK: @Func({{.*}}) !prof [[REMAINCOUNT:![0-9]+]] |
| 6 | entry: |
| 7 | br i1 %cond, label %if.then, label %return |
| 8 | if.then: |
| 9 | ; Dummy store to have more than 0 uses |
| 10 | store i32 10, i32* %align.val, align 4 |
| 11 | br label %return |
| 12 | return: ; preds = %entry |
| 13 | ret i32 0 |
| 14 | } |
| 15 | |
| 16 | define internal i32 @Caller1(i1 %cond, i32* align 2 %align.val) !prof !3{ |
| 17 | entry: |
| 18 | ; CHECK-LABEL: @Caller1 |
| 19 | ; CHECK: br |
| 20 | ; CHECK: call void @Func.1. |
| 21 | ; CHECK: br |
| 22 | ; CHECK: call void @Func.1. |
| 23 | %val = call i32 @Func(i1 %cond, i32* %align.val) |
| 24 | %val2 = call i32 @Func(i1 %cond, i32* %align.val) |
| 25 | ret i32 %val |
| 26 | } |
| 27 | |
| 28 | define internal i32 @Caller2(i1 %cond, i32* align 2 %align.val) !prof !2{ |
| 29 | entry: |
| 30 | ; CHECK-LABEL: @Caller2 |
| 31 | ; CHECK: br |
| 32 | ; CHECK: call void @Func.1. |
| 33 | %val = call i32 @Func(i1 %cond, i32* %align.val) |
| 34 | ret i32 %val |
| 35 | } |
| 36 | |
| 37 | ; CHECK: [[REMAINCOUNT]] = !{!"function_entry_count", i64 150} |
| 38 | !1 = !{!"function_entry_count", i64 200} |
| 39 | !2 = !{!"function_entry_count", i64 10} |
| 40 | !3 = !{!"function_entry_count", i64 20} |
| 41 | |