Manman Ren | 72d44b1 | 2015-10-15 14:59:40 +0000 | [diff] [blame] | 1 | ; RUN: opt -S -jump-threading %s | FileCheck %s |
| 2 | |
| 3 | ; Test if edge weights are properly updated after jump threading. |
| 4 | |
Cong Hou | e93b8e1 | 2015-12-22 18:56:14 +0000 | [diff] [blame] | 5 | ; CHECK: !2 = !{!"branch_weights", i32 1629125526, i32 518358122} |
Manman Ren | 72d44b1 | 2015-10-15 14:59:40 +0000 | [diff] [blame] | 6 | |
| 7 | define void @foo(i32 %n) !prof !0 { |
| 8 | entry: |
| 9 | %cmp = icmp sgt i32 %n, 10 |
| 10 | br i1 %cmp, label %if.then.1, label %if.else.1, !prof !1 |
| 11 | |
| 12 | if.then.1: |
| 13 | tail call void @a() |
| 14 | br label %if.cond |
| 15 | |
| 16 | if.else.1: |
| 17 | tail call void @b() |
| 18 | br label %if.cond |
| 19 | |
| 20 | if.cond: |
| 21 | %cmp1 = icmp sgt i32 %n, 5 |
| 22 | br i1 %cmp1, label %if.then.2, label %if.else.2, !prof !2 |
| 23 | |
| 24 | if.then.2: |
| 25 | tail call void @c() |
| 26 | br label %if.end |
| 27 | |
| 28 | if.else.2: |
| 29 | tail call void @d() |
| 30 | br label %if.end |
| 31 | |
| 32 | if.end: |
| 33 | ret void |
| 34 | } |
| 35 | |
| 36 | declare void @a() |
| 37 | declare void @b() |
| 38 | declare void @c() |
| 39 | declare void @d() |
| 40 | |
| 41 | !0 = !{!"function_entry_count", i64 1} |
| 42 | !1 = !{!"branch_weights", i32 10, i32 5} |
| 43 | !2 = !{!"branch_weights", i32 10, i32 1} |