Xinliang David Li | 66bdfca | 2017-05-12 23:41:43 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -partial-inliner -max-num-inline-blocks=2 -skip-partial-inlining-cost-analysis -S | FileCheck %s |
Sean Silva | f801575 | 2016-08-02 02:15:45 +0000 | [diff] [blame] | 2 | |
| 3 | ; This test checks to make sure that CodeExtractor updates |
| 4 | ; the exit branch probabilities for multiple exit blocks. |
| 5 | |
| 6 | define i32 @inlinedFunc(i1 %cond) !prof !1 { |
| 7 | entry: |
| 8 | br i1 %cond, label %if.then, label %return, !prof !2 |
| 9 | if.then: |
| 10 | br i1 %cond, label %return, label %return.2, !prof !3 |
| 11 | return.2: |
| 12 | ret i32 10 |
| 13 | return: ; preds = %entry |
| 14 | ret i32 0 |
| 15 | } |
| 16 | |
| 17 | |
| 18 | define internal i32 @dummyCaller(i1 %cond) !prof !1 { |
| 19 | entry: |
| 20 | %val = call i32 @inlinedFunc(i1 %cond) |
| 21 | ret i32 %val |
| 22 | |
| 23 | ; CHECK-LABEL: @dummyCaller |
| 24 | ; CHECK: call |
Xinliang David Li | d21601a | 2017-04-27 16:34:00 +0000 | [diff] [blame] | 25 | ; CHECK-NEXT: br i1 {{.*}}return.i{{.*}}return.2{{.*}}!prof [[COUNT1:![0-9]+]] |
Sean Silva | f801575 | 2016-08-02 02:15:45 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | !llvm.module.flags = !{!0} |
| 29 | !0 = !{i32 1, !"MaxFunctionCount", i32 10000} |
| 30 | !1 = !{!"function_entry_count", i64 10000} |
| 31 | !2 = !{!"branch_weights", i32 5, i32 5} |
| 32 | !3 = !{!"branch_weights", i32 4, i32 1} |
| 33 | |
Xinliang David Li | d21601a | 2017-04-27 16:34:00 +0000 | [diff] [blame] | 34 | ; CHECK: [[COUNT1]] = !{!"branch_weights", i32 31, i32 8} |