1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2 ; RUN: opt -S -passes="jump-threading" < %s 2>&1 | FileCheck %s
6 define i32 @func0(i32 %a0, i32 %a1) !prof !0 {
9 ; CHECK-NEXT: [[CMP0:%.*]] = icmp ne i32 [[A0:%.*]], 0
10 ; CHECK-NEXT: [[CX:%.*]] = icmp eq i32 [[A0]], 42
11 ; CHECK-NEXT: br i1 [[CMP0]], label [[BB_JOIN:%.*]], label [[TEST2:%.*]], !prof [[PROF1:![0-9]+]]
13 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[A1:%.*]], 0
14 ; CHECK-NEXT: br i1 [[CMP1]], label [[BB_JOIN_THREAD:%.*]], label [[TEST2_FALSE:%.*]], !prof [[PROF2:![0-9]+]]
16 ; CHECK-NEXT: call void @foobar()
17 ; CHECK-NEXT: br label [[TMP0:%.*]]
19 ; CHECK-NEXT: [[C:%.*]] = phi i1 [ [[CX]], [[ENTRY:%.*]] ]
20 ; CHECK-NEXT: [[COND_FR:%.*]] = freeze i1 [[C]]
21 ; CHECK-NEXT: br i1 [[COND_FR]], label [[BB_JOIN_THREAD]], label [[TMP0]], !prof [[PROF3:![0-9]+]]
22 ; CHECK: bb_join.thread:
23 ; CHECK-NEXT: br label [[TMP0]]
25 ; CHECK-NEXT: [[TMP1:%.*]] = phi i32 [ 42, [[BB_JOIN_THREAD]] ], [ 7, [[BB_JOIN]] ], [ 7, [[TEST2_FALSE]] ]
26 ; CHECK-NEXT: ret i32 [[TMP1]]
29 %cmp0 = icmp ne i32 %a0, 0
30 %cx = icmp eq i32 %a0, 42
31 br i1 %cmp0, label %bb_join, label %test2, !prof !1
34 %cmp1 = icmp ne i32 %a1, 0
35 br i1 %cmp1, label %bb_join, label %test2_false, !prof !2
42 %c = phi i1 [%cx, %entry], [true, %test2], [%cx, %test2_false]
43 %val = select i1 %c, i32 42, i32 7, !prof !3
47 !0 = !{!"function_entry_count", i64 1000}
48 !1 = !{!"branch_weights", i32 400, i32 600}
49 !2 = !{!"branch_weights", i32 300, i32 300}
50 !3 = !{!"branch_weights", i32 500, i32 500}
52 ; CHECK: [[META0:![0-9]+]] = !{!"function_entry_count", i64 1000}
53 ; CHECK: [[PROF1]] = !{!"branch_weights", i32 400, i32 600}
54 ; CHECK: [[PROF2]] = !{!"branch_weights", i32 300, i32 300}
55 ; CHECK: [[PROF3]] = !{!"branch_weights", i32 613566756, i32 1533916892}