1; RUN: opt -S -jump-threading %s | FileCheck %s
2
3; Test if edge weights are properly updated after jump threading.
4
5; CHECK: !2 = !{!"branch_weights", i32 22, i32 7}
6
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}
44