[llvm] 81ac23e - [InstCombine] Add additional tests for foldAndOrOfICmpEqZeroAndICmp (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 01:09:02 PST 2022
Author: Nikita Popov
Date: 2022-12-13T10:08:53+01:00
New Revision: 81ac23e0c208731bb946a1d6cf621d7fc5575c02
URL: https://github.com/llvm/llvm-project/commit/81ac23e0c208731bb946a1d6cf621d7fc5575c02
DIFF: https://github.com/llvm/llvm-project/commit/81ac23e0c208731bb946a1d6cf621d7fc5575c02.diff
LOG: [InstCombine] Add additional tests for foldAndOrOfICmpEqZeroAndICmp (NFC)
Adds logical variants of the commuted tests.
Added:
Modified:
llvm/test/Transforms/InstCombine/icmp.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/icmp.ll b/llvm/test/Transforms/InstCombine/icmp.ll
index d26720a297a4..18d47bca9f0d 100644
--- a/llvm/test/Transforms/InstCombine/icmp.ll
+++ b/llvm/test/Transforms/InstCombine/icmp.ll
@@ -2292,6 +2292,31 @@ define i1 @and_icmp_ne_B_0_icmp_uge_A_B_commuted2(i64 %a, i64 %b) {
ret i1 %3
}
+define i1 @and_icmp_ne_B_0_icmp_uge_A_B_commuted1_logical(i64 %a, i64 %b) {
+; CHECK-LABEL: @and_icmp_ne_B_0_icmp_uge_A_B_commuted1_logical(
+; CHECK-NEXT: [[TMP1:%.*]] = add i64 [[B:%.*]], -1
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ult i64 [[TMP1]], [[A:%.*]]
+; CHECK-NEXT: ret i1 [[TMP2]]
+;
+ %1 = icmp uge i64 %a, %b
+ %2 = icmp ne i64 %b, 0
+ %3 = select i1 %1, i1 %2, i1 false
+ ret i1 %3
+}
+
+define i1 @and_icmp_ne_B_0_icmp_uge_A_B_commuted2_logical(i64 %a, i64 %b) {
+; CHECK-LABEL: @and_icmp_ne_B_0_icmp_uge_A_B_commuted2_logical(
+; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i64 [[B:%.*]], 0
+; CHECK-NEXT: [[TMP2:%.*]] = icmp ule i64 [[B]], [[A:%.*]]
+; CHECK-NEXT: [[TMP3:%.*]] = select i1 [[TMP1]], i1 [[TMP2]], i1 false
+; CHECK-NEXT: ret i1 [[TMP3]]
+;
+ %1 = icmp ne i64 %b, 0
+ %2 = icmp ule i64 %b, %a
+ %3 = select i1 %1, i1 %2, i1 false
+ ret i1 %3
+}
+
define i1 @and_icmp_ne_B_0_icmp_uge_A_B_extra_use1(i64 %a, i64 %b) {
; CHECK-LABEL: @and_icmp_ne_B_0_icmp_uge_A_B_extra_use1(
; CHECK-NEXT: [[TMP1:%.*]] = icmp ne i64 [[B:%.*]], 0
More information about the llvm-commits
mailing list