blob: 58cd71861d8a1bea988281342d7ba78034835fdf [file] [log] [blame]
Manman Ren72d44b12015-10-15 14:59:40 +00001; RUN: opt -S -jump-threading %s | FileCheck %s
2
3; Test if edge weights are properly updated after jump threading.
4
Cong Houe93b8e12015-12-22 18:56:14 +00005; CHECK: !2 = !{!"branch_weights", i32 1629125526, i32 518358122}
Manman Ren72d44b12015-10-15 14:59:40 +00006
7define void @foo(i32 %n) !prof !0 {
8entry:
9 %cmp = icmp sgt i32 %n, 10
10 br i1 %cmp, label %if.then.1, label %if.else.1, !prof !1
11
12if.then.1:
13 tail call void @a()
14 br label %if.cond
15
16if.else.1:
17 tail call void @b()
18 br label %if.cond
19
20if.cond:
21 %cmp1 = icmp sgt i32 %n, 5
22 br i1 %cmp1, label %if.then.2, label %if.else.2, !prof !2
23
24if.then.2:
25 tail call void @c()
26 br label %if.end
27
28if.else.2:
29 tail call void @d()
30 br label %if.end
31
32if.end:
33 ret void
34}
35
36declare void @a()
37declare void @b()
38declare void @c()
39declare 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}