| Manman Ren | 4ece745 | 2014-01-31 00:42:44 +0000 | [diff] [blame] | 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 |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 16 | %v3 = load i32, i32* @max_regno, align 4 |
| Manman Ren | 4ece745 | 2014-01-31 00:42:44 +0000 | [diff] [blame] | 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 |
| Cong Hou | d97c100 | 2015-12-01 05:29:22 +0000 | [diff] [blame] | 21 | ; CHECK: Successors according to CFG: BB#3({{[0-9a-fx/= ]+}}1.53%) BB#4({{[0-9a-fx/= ]+}}98.47%) |
| Manman Ren | 4ece745 | 2014-01-31 00:42:44 +0000 | [diff] [blame] | 22 | ; CHECK: BB#4: derived from LLVM BB %for.cond2 |
| Cong Hou | d97c100 | 2015-12-01 05:29:22 +0000 | [diff] [blame] | 23 | ; CHECK: Successors according to CFG: BB#3({{[0-9a-fx/= ]+}}1.55%) BB#2({{[0-9a-fx/= ]+}}98.45%) |
| Manman Ren | 4ece745 | 2014-01-31 00:42:44 +0000 | [diff] [blame] | 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 | |
| Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 34 | !0 = !{!"branch_weights", i32 112017436, i32 -735157296} |