1 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -print-machineinstrs=expand-isel-pseudos -o /dev/null 2>&1 | FileCheck %s 2 3 ;; Make sure a transformation in SelectionDAGBuilder that converts "or + br" to 4 ;; two branches correctly updates the branch probability. 5 6 @max_regno = common global i32 0, align 4 7 8 define void @test(i32* %old, i32 %final) { 9 for.cond: 10 br label %for.cond2 11 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, i32* @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: derived from LLVM BB %for.cond2 21 ; CHECK: Successors according to CFG: BB#3(56008718) BB#4(2203492365) 22 ; CHECK: BB#4: derived from LLVM BB %for.cond2 23 ; CHECK: Successors according to CFG: BB#3(112017436) BB#2(4294967294) 24 25 for.inc: ; preds = %for.cond2 26 %shl = shl i32 %bit.0, 1 27 %inc19 = add nsw i32 %i.1, 1 28 br label %for.cond2 29 30 for.inc20: ; preds = %for.cond2 31 ret void 32 } 33 34 !0 = !{!"branch_weights", i32 112017436, i32 -735157296} 35