1*ab1b42acSNoah Goldstein; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2*ab1b42acSNoah Goldstein; RUN: opt -S -passes=instcombine < %s | FileCheck %s 3*ab1b42acSNoah Goldstein 4*ab1b42acSNoah Goldsteindefine i1 @sdiv_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) { 5*ab1b42acSNoah Goldstein; CHECK-LABEL: @sdiv_by_zero_indirect_is_poison( 6*ab1b42acSNoah Goldstein; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]] 7*ab1b42acSNoah Goldstein; CHECK: true: 8*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE:%.*]] 9*ab1b42acSNoah Goldstein; CHECK: false: 10*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE]] 11*ab1b42acSNoah Goldstein; CHECK: done: 12*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 poison 13*ab1b42acSNoah Goldstein; 14*ab1b42acSNoah Goldstein br i1 %c, label %true, label %false 15*ab1b42acSNoah Goldsteintrue: 16*ab1b42acSNoah Goldstein %y_true = and i1 %y, 0 17*ab1b42acSNoah Goldstein br label %done 18*ab1b42acSNoah Goldsteinfalse: 19*ab1b42acSNoah Goldstein %y_false = and i1 %y, 0 20*ab1b42acSNoah Goldstein br label %done 21*ab1b42acSNoah Goldsteindone: 22*ab1b42acSNoah Goldstein %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ] 23*ab1b42acSNoah Goldstein %r = sdiv i1 %x, %yy 24*ab1b42acSNoah Goldstein ret i1 %r 25*ab1b42acSNoah Goldstein} 26*ab1b42acSNoah Goldstein 27*ab1b42acSNoah Goldsteindefine i1 @udiv_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) { 28*ab1b42acSNoah Goldstein; CHECK-LABEL: @udiv_by_zero_indirect_is_poison( 29*ab1b42acSNoah Goldstein; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]] 30*ab1b42acSNoah Goldstein; CHECK: true: 31*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE:%.*]] 32*ab1b42acSNoah Goldstein; CHECK: false: 33*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE]] 34*ab1b42acSNoah Goldstein; CHECK: done: 35*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 poison 36*ab1b42acSNoah Goldstein; 37*ab1b42acSNoah Goldstein br i1 %c, label %true, label %false 38*ab1b42acSNoah Goldsteintrue: 39*ab1b42acSNoah Goldstein %y_true = and i1 %y, 0 40*ab1b42acSNoah Goldstein br label %done 41*ab1b42acSNoah Goldsteinfalse: 42*ab1b42acSNoah Goldstein %y_false = and i1 %y, 0 43*ab1b42acSNoah Goldstein br label %done 44*ab1b42acSNoah Goldsteindone: 45*ab1b42acSNoah Goldstein %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ] 46*ab1b42acSNoah Goldstein %r = udiv i1 %x, %yy 47*ab1b42acSNoah Goldstein ret i1 %r 48*ab1b42acSNoah Goldstein} 49*ab1b42acSNoah Goldstein 50*ab1b42acSNoah Goldsteindefine i1 @srem_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) { 51*ab1b42acSNoah Goldstein; CHECK-LABEL: @srem_by_zero_indirect_is_poison( 52*ab1b42acSNoah Goldstein; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]] 53*ab1b42acSNoah Goldstein; CHECK: true: 54*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE:%.*]] 55*ab1b42acSNoah Goldstein; CHECK: false: 56*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE]] 57*ab1b42acSNoah Goldstein; CHECK: done: 58*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 poison 59*ab1b42acSNoah Goldstein; 60*ab1b42acSNoah Goldstein br i1 %c, label %true, label %false 61*ab1b42acSNoah Goldsteintrue: 62*ab1b42acSNoah Goldstein %y_true = and i1 %y, 0 63*ab1b42acSNoah Goldstein br label %done 64*ab1b42acSNoah Goldsteinfalse: 65*ab1b42acSNoah Goldstein %y_false = and i1 %y, 0 66*ab1b42acSNoah Goldstein br label %done 67*ab1b42acSNoah Goldsteindone: 68*ab1b42acSNoah Goldstein %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ] 69*ab1b42acSNoah Goldstein %r = srem i1 %x, %yy 70*ab1b42acSNoah Goldstein ret i1 %r 71*ab1b42acSNoah Goldstein} 72*ab1b42acSNoah Goldstein 73*ab1b42acSNoah Goldsteindefine i1 @urem_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) { 74*ab1b42acSNoah Goldstein; CHECK-LABEL: @urem_by_zero_indirect_is_poison( 75*ab1b42acSNoah Goldstein; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]] 76*ab1b42acSNoah Goldstein; CHECK: true: 77*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE:%.*]] 78*ab1b42acSNoah Goldstein; CHECK: false: 79*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[DONE]] 80*ab1b42acSNoah Goldstein; CHECK: done: 81*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 poison 82*ab1b42acSNoah Goldstein; 83*ab1b42acSNoah Goldstein br i1 %c, label %true, label %false 84*ab1b42acSNoah Goldsteintrue: 85*ab1b42acSNoah Goldstein %y_true = and i1 %y, 0 86*ab1b42acSNoah Goldstein br label %done 87*ab1b42acSNoah Goldsteinfalse: 88*ab1b42acSNoah Goldstein %y_false = and i1 %y, 0 89*ab1b42acSNoah Goldstein br label %done 90*ab1b42acSNoah Goldsteindone: 91*ab1b42acSNoah Goldstein %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ] 92*ab1b42acSNoah Goldstein %r = urem i1 %x, %yy 93*ab1b42acSNoah Goldstein ret i1 %r 94*ab1b42acSNoah Goldstein} 95*ab1b42acSNoah Goldstein 96*ab1b42acSNoah Goldsteindefine i1 @sdiv_i1_is_op0(i1 %x, i1 %y) { 97*ab1b42acSNoah Goldstein; CHECK-LABEL: @sdiv_i1_is_op0( 98*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 [[X:%.*]] 99*ab1b42acSNoah Goldstein; 100*ab1b42acSNoah Goldstein %r = sdiv i1 %x, %y 101*ab1b42acSNoah Goldstein ret i1 %r 102*ab1b42acSNoah Goldstein} 103*ab1b42acSNoah Goldstein 104*ab1b42acSNoah Goldsteindefine i1 @udiv_i1_is_op0(i1 %x, i1 %y) { 105*ab1b42acSNoah Goldstein; CHECK-LABEL: @udiv_i1_is_op0( 106*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 [[X:%.*]] 107*ab1b42acSNoah Goldstein; 108*ab1b42acSNoah Goldstein %r = udiv i1 %x, %y 109*ab1b42acSNoah Goldstein ret i1 %r 110*ab1b42acSNoah Goldstein} 111*ab1b42acSNoah Goldstein 112*ab1b42acSNoah Goldsteindefine i1 @srem_i1_is_zero(i1 %x, i1 %y) { 113*ab1b42acSNoah Goldstein; CHECK-LABEL: @srem_i1_is_zero( 114*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 false 115*ab1b42acSNoah Goldstein; 116*ab1b42acSNoah Goldstein %r = srem i1 %x, %y 117*ab1b42acSNoah Goldstein ret i1 %r 118*ab1b42acSNoah Goldstein} 119*ab1b42acSNoah Goldstein 120*ab1b42acSNoah Goldsteindefine i1 @urem_i1_is_zero(i1 %x, i1 %y) { 121*ab1b42acSNoah Goldstein; CHECK-LABEL: @urem_i1_is_zero( 122*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 false 123*ab1b42acSNoah Goldstein; 124*ab1b42acSNoah Goldstein %r = urem i1 %x, %y 125*ab1b42acSNoah Goldstein ret i1 %r 126*ab1b42acSNoah Goldstein} 127*ab1b42acSNoah Goldstein 128*ab1b42acSNoah Goldsteindeclare void @llvm.assume(i1 noundef) 129*ab1b42acSNoah Goldstein 130*ab1b42acSNoah Goldsteindefine i1 @pt62607() { 131*ab1b42acSNoah Goldstein; CHECK-LABEL: @pt62607( 132*ab1b42acSNoah Goldstein; CHECK-NEXT: entry_1: 133*ab1b42acSNoah Goldstein; CHECK-NEXT: br label [[LOOP_5:%.*]] 134*ab1b42acSNoah Goldstein; CHECK: loop_5: 135*ab1b42acSNoah Goldstein; CHECK-NEXT: br i1 poison, label [[LOOP_5]], label [[LOOP_EXIT_8:%.*]] 136*ab1b42acSNoah Goldstein; CHECK: loop_exit_8: 137*ab1b42acSNoah Goldstein; CHECK-NEXT: ret i1 false 138*ab1b42acSNoah Goldstein; 139*ab1b42acSNoah Goldsteinentry_1: 140*ab1b42acSNoah Goldstein %val_i1_38 = trunc i8 109 to i1 141*ab1b42acSNoah Goldstein br label %loop_5 142*ab1b42acSNoah Goldsteinloop_5: ; preds = %loop_5, %entry_1 143*ab1b42acSNoah Goldstein %loop_cnt_i1_26.0 = phi i1 [ false, %entry_1 ], [ %val_i1_55, %loop_5 ] 144*ab1b42acSNoah Goldstein %val_i1_55 = add i1 %loop_cnt_i1_26.0, true 145*ab1b42acSNoah Goldstein call void @llvm.assume(i1 %val_i1_55) 146*ab1b42acSNoah Goldstein %val_i1_67 = udiv i1 %val_i1_38, %loop_cnt_i1_26.0 147*ab1b42acSNoah Goldstein br i1 %val_i1_67, label %loop_5, label %loop_exit_8 148*ab1b42acSNoah Goldsteinloop_exit_8: ; preds = %loop_5 149*ab1b42acSNoah Goldstein ret i1 false 150*ab1b42acSNoah Goldstein} 151