define i1 @test13(i1 %A, i1 %B) {
; CHECK-LABEL: @test13(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %B, true
-; CHECK-NEXT: [[C:%.*]] = or i1 [[CTMP]], %A
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %B, true
+; CHECK-NEXT: [[C:%.*]] = or i1 [[TMP1]], %A
; CHECK-NEXT: ret i1 [[C]]
;
%C = icmp uge i1 %A, %B
define <2 x i1> @test13vec(<2 x i1> %A, <2 x i1> %B) {
; CHECK-LABEL: @test13vec(
-; CHECK-NEXT: [[CTMP:%.*]] = xor <2 x i1> %B, <i1 true, i1 true>
-; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[CTMP]], %A
+; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i1> %B, <i1 true, i1 true>
+; CHECK-NEXT: [[C:%.*]] = or <2 x i1> [[TMP1]], %A
; CHECK-NEXT: ret <2 x i1> [[C]]
;
%C = icmp uge <2 x i1> %A, %B
define i1 @test14(i1 %A, i1 %B) {
; CHECK-LABEL: @test14(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor i1 [[CTMP]], true
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor i1 [[TMP1]], true
; CHECK-NEXT: ret i1 [[C]]
;
%C = icmp eq i1 %A, %B
define <3 x i1> @test14vec(<3 x i1> %A, <3 x i1> %B) {
; CHECK-LABEL: @test14vec(
-; CHECK-NEXT: [[CTMP:%.*]] = xor <3 x i1> %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[CTMP]], <i1 true, i1 true, i1 true>
+; CHECK-NEXT: [[TMP1:%.*]] = xor <3 x i1> %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor <3 x i1> [[TMP1]], <i1 true, i1 true, i1 true>
; CHECK-NEXT: ret <3 x i1> [[C]]
;
%C = icmp eq <3 x i1> %A, %B
ret <3 x i1> %C
}
+; FIXME: Not recognizing the icmp bool with constant exposes a missing fold.
+
+define i1 @bool_eq0(i64 %a) {
+; CHECK-LABEL: @bool_eq0(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i64 %a, 0
+; CHECK-NEXT: [[C:%.*]] = icmp eq i64 %a, 1
+; CHECK-NEXT: [[AND:%.*]] = xor i1 [[C]], [[B]]
+; CHECK-NEXT: ret i1 [[AND]]
+;
+ %b = icmp sgt i64 %a, 0
+ %c = icmp eq i64 %a, 1
+ %notc = icmp eq i1 %c, false
+ %and = and i1 %b, %notc
+ ret i1 %and
+}
+
define i1 @test16(i32 %A) {
; CHECK-LABEL: @test16(
; CHECK-NEXT: ret i1 false
define i1 @test19(i1 %A, i1 %B) {
; CHECK-LABEL: @test19(
-; CHECK-NEXT: [[CTMP:%.*]] = xor i1 %A, %B
-; CHECK-NEXT: [[C:%.*]] = xor i1 [[CTMP]], true
+; CHECK-NEXT: [[TMP1:%.*]] = xor i1 %A, %B
+; CHECK-NEXT: [[C:%.*]] = xor i1 [[TMP1]], true
; CHECK-NEXT: ret i1 [[C]]
;
%a = zext i1 %A to i32