ret i1 %res
}
+define i1 @cond_eq_and_const(i8 %X, i8 %Y) {
+; CHECK-LABEL: @cond_eq_and_const(
+; CHECK-NEXT: [[COND:%.*]] = icmp eq i8 [[X:%.*]], 10
+; CHECK-NEXT: [[LHS:%.*]] = icmp ult i8 [[X]], [[Y:%.*]]
+; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 [[LHS]], i1 false
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %cond = icmp eq i8 %X, 10
+ %lhs = icmp ult i8 %X, %Y
+ %res = select i1 %cond, i1 %lhs, i1 false
+ ret i1 %res
+}
+
define i1 @cond_eq_or(i8 %X, i8 %Y, i8 noundef %C) {
; CHECK-LABEL: @cond_eq_or(
; CHECK-NEXT: [[COND:%.*]] = icmp ne i8 [[X:%.*]], [[C:%.*]]
ret i1 %res
}
+define i1 @cond_eq_or_const(i8 %X, i8 %Y) {
+; CHECK-LABEL: @cond_eq_or_const(
+; CHECK-NEXT: [[COND:%.*]] = icmp ne i8 [[X:%.*]], 10
+; CHECK-NEXT: [[LHS:%.*]] = icmp ult i8 [[X]], [[Y:%.*]]
+; CHECK-NEXT: [[RES:%.*]] = select i1 [[COND]], i1 true, i1 [[LHS]]
+; CHECK-NEXT: ret i1 [[RES]]
+;
+ %cond = icmp ne i8 %X, 10
+ %lhs = icmp ult i8 %X, %Y
+ %res = select i1 %cond, i1 true, i1 %lhs
+ ret i1 %res
+}
+
define i1 @merge_and(i1 %X, i1 %Y) {
; CHECK-LABEL: @merge_and(
; CHECK-NEXT: [[C:%.*]] = select i1 [[X:%.*]], i1 [[Y:%.*]], i1 false