1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -passes=instcombine -S | FileCheck %s 3 4target datalayout = "e-p:32:32" 5target triple = "i686-pc-linux-gnu" 6@r = external global [17 x i32] ; <ptr> [#uses=1] 7 8define i1 @print_pgm_cond_true(i32 %tmp12.reload, ptr %tmp16.out) { 9; CHECK-LABEL: @print_pgm_cond_true( 10; CHECK-NEXT: newFuncRoot: 11; CHECK-NEXT: br label [[COND_TRUE:%.*]] 12; CHECK: bb27.exitStub: 13; CHECK-NEXT: store i32 [[TMP16:%.*]], ptr [[TMP16_OUT:%.*]], align 4 14; CHECK-NEXT: ret i1 true 15; CHECK: cond_next23.exitStub: 16; CHECK-NEXT: store i32 [[TMP16]], ptr [[TMP16_OUT]], align 4 17; CHECK-NEXT: ret i1 false 18; CHECK: cond_true: 19; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], ptr @r, i32 0, i32 [[TMP12_RELOAD:%.*]] 20; CHECK-NEXT: [[TMP16]] = load i32, ptr [[TMP15]], align 4 21; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[TMP16]], -32 22; CHECK-NEXT: [[BOTHCOND:%.*]] = icmp ult i32 [[TMP0]], -63 23; CHECK-NEXT: br i1 [[BOTHCOND]], label [[BB27_EXITSTUB:%.*]], label [[COND_NEXT23_EXITSTUB:%.*]] 24; 25newFuncRoot: 26 br label %cond_true 27 28bb27.exitStub: ; preds = %cond_true 29 store i32 %tmp16, ptr %tmp16.out 30 ret i1 true 31 32cond_next23.exitStub: ; preds = %cond_true 33 store i32 %tmp16, ptr %tmp16.out 34 ret i1 false 35 36cond_true: ; preds = %newFuncRoot 37 %tmp15 = getelementptr [17 x i32], ptr @r, i32 0, i32 %tmp12.reload ; <ptr> [#uses=1] 38 %tmp16 = load i32, ptr %tmp15 ; <i32> [#uses=4] 39 %tmp18 = icmp slt i32 %tmp16, -31 ; <i1> [#uses=1] 40 %tmp21 = icmp sgt i32 %tmp16, 31 ; <i1> [#uses=1] 41 %bothcond = or i1 %tmp18, %tmp21 ; <i1> [#uses=1] 42 br i1 %bothcond, label %bb27.exitStub, label %cond_next23.exitStub 43} 44 45define i1 @print_pgm_cond_true_logical(i32 %tmp12.reload, ptr %tmp16.out) { 46; CHECK-LABEL: @print_pgm_cond_true_logical( 47; CHECK-NEXT: newFuncRoot: 48; CHECK-NEXT: br label [[COND_TRUE:%.*]] 49; CHECK: bb27.exitStub: 50; CHECK-NEXT: store i32 [[TMP16:%.*]], ptr [[TMP16_OUT:%.*]], align 4 51; CHECK-NEXT: ret i1 true 52; CHECK: cond_next23.exitStub: 53; CHECK-NEXT: store i32 [[TMP16]], ptr [[TMP16_OUT]], align 4 54; CHECK-NEXT: ret i1 false 55; CHECK: cond_true: 56; CHECK-NEXT: [[TMP15:%.*]] = getelementptr [17 x i32], ptr @r, i32 0, i32 [[TMP12_RELOAD:%.*]] 57; CHECK-NEXT: [[TMP16]] = load i32, ptr [[TMP15]], align 4 58; CHECK-NEXT: [[TMP0:%.*]] = add i32 [[TMP16]], -32 59; CHECK-NEXT: [[BOTHCOND:%.*]] = icmp ult i32 [[TMP0]], -63 60; CHECK-NEXT: br i1 [[BOTHCOND]], label [[BB27_EXITSTUB:%.*]], label [[COND_NEXT23_EXITSTUB:%.*]] 61; 62newFuncRoot: 63 br label %cond_true 64 65bb27.exitStub: ; preds = %cond_true 66 store i32 %tmp16, ptr %tmp16.out 67 ret i1 true 68 69cond_next23.exitStub: ; preds = %cond_true 70 store i32 %tmp16, ptr %tmp16.out 71 ret i1 false 72 73cond_true: ; preds = %newFuncRoot 74 %tmp15 = getelementptr [17 x i32], ptr @r, i32 0, i32 %tmp12.reload ; <ptr> [#uses=1] 75 %tmp16 = load i32, ptr %tmp15 ; <i32> [#uses=4] 76 %tmp18 = icmp slt i32 %tmp16, -31 ; <i1> [#uses=1] 77 %tmp21 = icmp sgt i32 %tmp16, 31 ; <i1> [#uses=1] 78 %bothcond = select i1 %tmp18, i1 true, i1 %tmp21 ; <i1> [#uses=1] 79 br i1 %bothcond, label %bb27.exitStub, label %cond_next23.exitStub 80} 81 82