1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=instcombine < %s | FileCheck %s
4 define i1 @sdiv_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) {
5 ; CHECK-LABEL: @sdiv_by_zero_indirect_is_poison(
6 ; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
8 ; CHECK-NEXT: br label [[DONE:%.*]]
10 ; CHECK-NEXT: br label [[DONE]]
12 ; CHECK-NEXT: ret i1 poison
14 br i1 %c, label %true, label %false
16 %y_true = and i1 %y, 0
19 %y_false = and i1 %y, 0
22 %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ]
27 define i1 @udiv_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) {
28 ; CHECK-LABEL: @udiv_by_zero_indirect_is_poison(
29 ; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
31 ; CHECK-NEXT: br label [[DONE:%.*]]
33 ; CHECK-NEXT: br label [[DONE]]
35 ; CHECK-NEXT: ret i1 poison
37 br i1 %c, label %true, label %false
39 %y_true = and i1 %y, 0
42 %y_false = and i1 %y, 0
45 %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ]
50 define i1 @srem_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) {
51 ; CHECK-LABEL: @srem_by_zero_indirect_is_poison(
52 ; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
54 ; CHECK-NEXT: br label [[DONE:%.*]]
56 ; CHECK-NEXT: br label [[DONE]]
58 ; CHECK-NEXT: ret i1 poison
60 br i1 %c, label %true, label %false
62 %y_true = and i1 %y, 0
65 %y_false = and i1 %y, 0
68 %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ]
73 define i1 @urem_by_zero_indirect_is_poison(i1 %c, i1 %x, i1 %y) {
74 ; CHECK-LABEL: @urem_by_zero_indirect_is_poison(
75 ; CHECK-NEXT: br i1 [[C:%.*]], label [[TRUE:%.*]], label [[FALSE:%.*]]
77 ; CHECK-NEXT: br label [[DONE:%.*]]
79 ; CHECK-NEXT: br label [[DONE]]
81 ; CHECK-NEXT: ret i1 poison
83 br i1 %c, label %true, label %false
85 %y_true = and i1 %y, 0
88 %y_false = and i1 %y, 0
91 %yy = phi i1 [ %y_false, %false ], [ %y_true, %true ]
96 define i1 @sdiv_i1_is_op0(i1 %x, i1 %y) {
97 ; CHECK-LABEL: @sdiv_i1_is_op0(
98 ; CHECK-NEXT: ret i1 [[X:%.*]]
104 define i1 @udiv_i1_is_op0(i1 %x, i1 %y) {
105 ; CHECK-LABEL: @udiv_i1_is_op0(
106 ; CHECK-NEXT: ret i1 [[X:%.*]]
112 define i1 @srem_i1_is_zero(i1 %x, i1 %y) {
113 ; CHECK-LABEL: @srem_i1_is_zero(
114 ; CHECK-NEXT: ret i1 false
120 define i1 @urem_i1_is_zero(i1 %x, i1 %y) {
121 ; CHECK-LABEL: @urem_i1_is_zero(
122 ; CHECK-NEXT: ret i1 false
128 declare void @llvm.assume(i1 noundef)
130 define i1 @pt62607() {
131 ; CHECK-LABEL: @pt62607(
132 ; CHECK-NEXT: entry_1:
133 ; CHECK-NEXT: br label [[LOOP_5:%.*]]
135 ; CHECK-NEXT: br i1 poison, label [[LOOP_5]], label [[LOOP_EXIT_8:%.*]]
136 ; CHECK: loop_exit_8:
137 ; CHECK-NEXT: ret i1 false
140 %val_i1_38 = trunc i8 109 to i1
142 loop_5: ; preds = %loop_5, %entry_1
143 %loop_cnt_i1_26.0 = phi i1 [ false, %entry_1 ], [ %val_i1_55, %loop_5 ]
144 %val_i1_55 = add i1 %loop_cnt_i1_26.0, true
145 call void @llvm.assume(i1 %val_i1_55)
146 %val_i1_67 = udiv i1 %val_i1_38, %loop_cnt_i1_26.0
147 br i1 %val_i1_67, label %loop_5, label %loop_exit_8
148 loop_exit_8: ; preds = %loop_5