Sanjay Patel | ee52b6e | 2016-03-14 20:18:59 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -S -inline | FileCheck %s |
| 2 | |
| 3 | ; Make sure that profile metadata is preserved when cloning a select. |
| 4 | |
| 5 | define i32 @callee_with_select(i1 %c, i32 %a, i32 %b) { |
| 6 | %sel = select i1 %c, i32 %a, i32 %b, !prof !0 |
| 7 | ret i32 %sel |
| 8 | } |
| 9 | |
| 10 | define i32 @caller_of_select(i1 %C, i32 %A, i32 %B) { |
| 11 | %ret = call i32 @callee_with_select(i1 %C, i32 %A, i32 %B) |
| 12 | ret i32 %ret |
| 13 | |
| 14 | ; CHECK-LABEL: @caller_of_select( |
| 15 | ; CHECK-NEXT: [[SEL:%.*]] = select i1 %C, i32 %A, i32 %B, !prof !0 |
| 16 | ; CHECK-NEXT: ret i32 [[SEL]] |
| 17 | } |
| 18 | |
| 19 | ; Make sure that profile metadata is preserved when cloning a branch. |
| 20 | |
| 21 | define i32 @callee_with_branch(i1 %c) { |
| 22 | br i1 %c, label %if, label %else, !prof !1 |
| 23 | if: |
| 24 | ret i32 1 |
| 25 | else: |
| 26 | ret i32 2 |
| 27 | } |
| 28 | |
| 29 | define i32 @caller_of_branch(i1 %C) { |
| 30 | %ret = call i32 @callee_with_branch(i1 %C) |
| 31 | ret i32 %ret |
| 32 | |
| 33 | ; CHECK-LABEL: @caller_of_branch( |
| 34 | ; CHECK-NEXT: br i1 %C, label %{{.*}}, label %{{.*}}, !prof !1 |
| 35 | } |
| 36 | |
| 37 | !0 = !{!"branch_weights", i32 1, i32 2} |
| 38 | !1 = !{!"branch_weights", i32 3, i32 4} |
| 39 | ; CHECK: !0 = !{!"branch_weights", i32 1, i32 2} |
| 40 | ; CHECK: !1 = !{!"branch_weights", i32 3, i32 4} |
| 41 | |