[llvm] ea1909f - [InstSimplify] Add tests for #69050 and #69091 (NFC)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 27 01:06:38 PDT 2023
Author: Nikita Popov
Date: 2023-10-27T09:50:35+02:00
New Revision: ea1909f82ceca30b009701f1d349247f8fbf1c3e
URL: https://github.com/llvm/llvm-project/commit/ea1909f82ceca30b009701f1d349247f8fbf1c3e
DIFF: https://github.com/llvm/llvm-project/commit/ea1909f82ceca30b009701f1d349247f8fbf1c3e.diff
LOG: [InstSimplify] Add tests for #69050 and #69091 (NFC)
Added:
Modified:
llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll b/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
index df442dd8f185c81..db38077e0c51308 100644
--- a/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
+++ b/llvm/test/Transforms/InstSimplify/and-or-implied-cond.ll
@@ -230,3 +230,37 @@ define i1 @uaddo_or_commuted3(i64 %a, i64 %b){
%cond = or i1 %cond_a, %cond_b
ret i1 %cond
}
+
+define i1 @pr69050(i32 %arg, i32 %arg1) {
+; CHECK-LABEL: @pr69050(
+; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[ARG:%.*]], -1
+; CHECK-NEXT: [[AND:%.*]] = and i32 [[XOR]], [[ARG1:%.*]]
+; CHECK-NEXT: [[ICMP:%.*]] = icmp ne i32 [[AND]], 0
+; CHECK-NEXT: [[ICMP2:%.*]] = icmp ne i32 [[ARG]], -1
+; CHECK-NEXT: [[AND3:%.*]] = and i1 [[ICMP2]], [[ICMP]]
+; CHECK-NEXT: ret i1 [[AND3]]
+;
+ %xor = xor i32 %arg, -1
+ %and = and i32 %xor, %arg1
+ %icmp = icmp ne i32 %and, 0
+ %icmp2 = icmp ne i32 %arg, -1
+ %and3 = and i1 %icmp2, %icmp
+ ret i1 %and3
+}
+
+define i1 @pr69091(i32 %arg, i32 %arg1) {
+; CHECK-LABEL: @pr69091(
+; CHECK-NEXT: [[ICMP:%.*]] = icmp ne i32 [[ARG:%.*]], -1
+; CHECK-NEXT: [[ADD:%.*]] = add i32 [[ARG]], 1
+; CHECK-NEXT: [[MUL:%.*]] = mul i32 [[ADD]], [[ARG1:%.*]]
+; CHECK-NEXT: [[ICMP2:%.*]] = icmp ne i32 [[MUL]], 0
+; CHECK-NEXT: [[OR:%.*]] = or i1 [[ICMP]], [[ICMP2]]
+; CHECK-NEXT: ret i1 [[OR]]
+;
+ %icmp = icmp ne i32 %arg, -1
+ %add = add i32 %arg, 1
+ %mul = mul i32 %add, %arg1
+ %icmp2 = icmp ne i32 %mul, 0
+ %or = or i1 %icmp, %icmp2
+ ret i1 %or
+}
More information about the llvm-commits
mailing list