1 ; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=0 | FileCheck %s --check-prefix=JUMP2 --check-prefix=CHECK 2 ; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=1 | FileCheck %s --check-prefix=JUMP1 --check-prefix=CHECK 3 4 define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind { 5 ; JUMP2-LABEL: foo: 6 ; JUMP2-DAG: jl 7 ; JUMP2-DAG: je 8 ; 9 ; JUMP1-LABEL: foo: 10 ; JUMP1-DAG: sete 11 ; JUMP1-DAG: setl 12 ; JUMP1: orb 13 ; JUMP1: jne 14 entry: 15 %tmp1 = icmp eq i32 %X, 0 16 %tmp3 = icmp slt i32 %Y, 5 17 %tmp4 = or i1 %tmp3, %tmp1 18 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock 19 20 cond_true: 21 %tmp5 = tail call i32 (...) @bar( ) 22 ret void 23 24 UnifiedReturnBlock: 25 ret void 26 } 27 28 ; If the branch is unpredictable, don't add another branch 29 ; regardless of whether they are expensive or not. 30 31 define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind { 32 ; CHECK-LABEL: unpredictable: 33 ; CHECK-DAG: sete 34 ; CHECK-DAG: setl 35 ; CHECK: orb 36 ; CHECK: jne 37 entry: 38 %tmp1 = icmp eq i32 %X, 0 39 %tmp3 = icmp slt i32 %Y, 5 40 %tmp4 = or i1 %tmp3, %tmp1 41 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0 42 43 cond_true: 44 %tmp5 = tail call i32 (...) @bar( ) 45 ret void 46 47 UnifiedReturnBlock: 48 ret void 49 } 50 51 declare i32 @bar(...) 52 53 !0 = !{} 54 55