Revert r254348: "Replace all weight-based interfaces in MBB with probability-based...
[oota-llvm.git] / test / CodeGen / X86 / MachineBranchProb.ll
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(32756933) BB#4(2114726715)
22 ; CHECK: BB#4: derived from LLVM BB %for.cond2
23 ; CHECK: Successors according to CFG: BB#3(33264335) BB#2(2114219313)
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}