1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -print-after=finalize-isel -o /dev/null 2>&1 | FileCheck %s
3 ;; Make sure a transformation in SelectionDAGBuilder that converts "or + br" to
4 ;; two branches correctly updates the branch probability.
6 @max_regno = common global i32 0, align 4
8 define void @test(ptr %old, i32 %final) {
12 for.cond2: ; preds = %for.inc, %for.cond
13 %i.1 = phi i32 [ %inc19, %for.inc ], [ 0, %for.cond ]
14 %bit.0 = phi i32 [ %shl, %for.inc ], [ 1, %for.cond ]
15 %tobool = icmp eq i32 %bit.0, 0
16 %v3 = load i32, ptr @max_regno, align 4
17 %cmp4 = icmp eq i32 %i.1, %v3
18 %or.cond = or i1 %tobool, %cmp4
19 br i1 %or.cond, label %for.inc20, label %for.inc, !prof !0
20 ; CHECK: bb.1.for.cond2:
21 ; CHECK: successors: %bb.3(0x01f3d4c5), %bb.4(0x7e0c2b3b)
22 ; CHECK: bb.4.for.cond2:
23 ; CHECK: successors: %bb.3(0x01fb92cf), %bb.2(0x7e046d31)
25 for.inc: ; preds = %for.cond2
26 %shl = shl i32 %bit.0, 1
27 %inc19 = add nsw i32 %i.1, 1
30 for.inc20: ; preds = %for.cond2
34 !0 = !{!"branch_weights", i32 112017436, i32 -735157296}