[llvm] 2a38d83 - [InstSimplify] Add pre-commits for PR#66606. NFC.
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 10:01:14 PDT 2023
Author: Yingwei Zheng
Date: 2023-09-19T01:00:34+08:00
New Revision: 2a38d8391868c4761380c35a4002680a05c7617e
URL: https://github.com/llvm/llvm-project/commit/2a38d8391868c4761380c35a4002680a05c7617e
DIFF: https://github.com/llvm/llvm-project/commit/2a38d8391868c4761380c35a4002680a05c7617e.diff
LOG: [InstSimplify] Add pre-commits for PR#66606. NFC.
Added:
Modified:
llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll b/llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll
index eb1d05d1822cee4..3e50a5968b46087 100644
--- a/llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll
+++ b/llvm/test/Transforms/InstSimplify/and-or-icmp-zero.ll
@@ -262,3 +262,29 @@ define i1 @and_cmps_ptr_eq_zero_with_mask_commute4(ptr %p, i64 %y) {
ret i1 %r
}
+; tests from PR66606
+define i32 @and_zext_eq_zero(i32 %a) {
+; CHECK-LABEL: @and_zext_eq_zero(
+; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
+; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
+; CHECK-NEXT: [[R:%.*]] = and i32 [[A]], [[NOT]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %cond = icmp eq i32 %a, 0
+ %not = zext i1 %cond to i32
+ %r = and i32 %a, %not
+ ret i32 %r
+}
+
+define i32 @and_zext_eq_zero_commuted(i32 %a) {
+; CHECK-LABEL: @and_zext_eq_zero_commuted(
+; CHECK-NEXT: [[COND:%.*]] = icmp eq i32 [[A:%.*]], 0
+; CHECK-NEXT: [[NOT:%.*]] = zext i1 [[COND]] to i32
+; CHECK-NEXT: [[R:%.*]] = and i32 [[NOT]], [[A]]
+; CHECK-NEXT: ret i32 [[R]]
+;
+ %cond = icmp eq i32 %a, 0
+ %not = zext i1 %cond to i32
+ %r = and i32 %not, %a
+ ret i32 %r
+}
More information about the llvm-commits
mailing list