1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=0 | FileCheck %s --check-prefix=JUMP2 3; RUN: llc < %s -mtriple=i386-unknown-unknown -jump-is-expensive=1 | FileCheck %s --check-prefix=JUMP1 4 5define void @foo(i32 %X, i32 %Y, i32 %Z) nounwind { 6; JUMP2-LABEL: foo: 7; JUMP2: # %bb.0: # %entry 8; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp) 9; JUMP2-NEXT: setne %al 10; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp) 11; JUMP2-NEXT: setge %cl 12; JUMP2-NEXT: testb %al, %cl 13; JUMP2-NEXT: je bar@PLT # TAILCALL 14; JUMP2-NEXT: # %bb.1: # %UnifiedReturnBlock 15; JUMP2-NEXT: retl 16; 17; JUMP1-LABEL: foo: 18; JUMP1: # %bb.0: # %entry 19; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp) 20; JUMP1-NEXT: setne %al 21; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp) 22; JUMP1-NEXT: setge %cl 23; JUMP1-NEXT: testb %al, %cl 24; JUMP1-NEXT: je bar@PLT # TAILCALL 25; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock 26; JUMP1-NEXT: retl 27entry: 28 %tmp1 = icmp eq i32 %X, 0 29 %tmp3 = icmp slt i32 %Y, 5 30 %tmp4 = or i1 %tmp3, %tmp1 31 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock 32 33cond_true: 34 %tmp5 = tail call i32 (...) @bar( ) 35 ret void 36 37UnifiedReturnBlock: 38 ret void 39} 40 41; If the branch is unpredictable, don't add another branch 42; regardless of whether they are expensive or not. 43 44define void @unpredictable(i32 %X, i32 %Y, i32 %Z) nounwind { 45; JUMP2-LABEL: unpredictable: 46; JUMP2: # %bb.0: # %entry 47; JUMP2-NEXT: cmpl $0, {{[0-9]+}}(%esp) 48; JUMP2-NEXT: setne %al 49; JUMP2-NEXT: cmpl $5, {{[0-9]+}}(%esp) 50; JUMP2-NEXT: setge %cl 51; JUMP2-NEXT: testb %al, %cl 52; JUMP2-NEXT: je bar@PLT # TAILCALL 53; JUMP2-NEXT: # %bb.1: # %UnifiedReturnBlock 54; JUMP2-NEXT: retl 55; 56; JUMP1-LABEL: unpredictable: 57; JUMP1: # %bb.0: # %entry 58; JUMP1-NEXT: cmpl $0, {{[0-9]+}}(%esp) 59; JUMP1-NEXT: setne %al 60; JUMP1-NEXT: cmpl $5, {{[0-9]+}}(%esp) 61; JUMP1-NEXT: setge %cl 62; JUMP1-NEXT: testb %al, %cl 63; JUMP1-NEXT: je bar@PLT # TAILCALL 64; JUMP1-NEXT: # %bb.1: # %UnifiedReturnBlock 65; JUMP1-NEXT: retl 66entry: 67 %tmp1 = icmp eq i32 %X, 0 68 %tmp3 = icmp slt i32 %Y, 5 69 %tmp4 = or i1 %tmp3, %tmp1 70 br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock, !unpredictable !0 71 72cond_true: 73 %tmp5 = tail call i32 (...) @bar( ) 74 ret void 75 76UnifiedReturnBlock: 77 ret void 78} 79 80declare i32 @bar(...) 81 82!0 = !{} 83 84