[PATCH] D150424: [ValueTracking] Add tests for deducing `X * Y != 0` if `LSB(X) * LSB(Y) != 0`; NFC
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 15 16:11:49 PDT 2023
goldstein.w.n updated this revision to Diff 522376.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D150424/new/
https://reviews.llvm.org/D150424
Files:
llvm/test/Analysis/ValueTracking/known-non-zero.ll
Index: llvm/test/Analysis/ValueTracking/known-non-zero.ll
===================================================================
--- llvm/test/Analysis/ValueTracking/known-non-zero.ll
+++ llvm/test/Analysis/ValueTracking/known-non-zero.ll
@@ -1096,3 +1096,33 @@
%r = icmp eq i8 %z, 0
ret i1 %r
}
+
+define i1 @mul_nonzero_contains_nonzero_mul(i8 %x, i8 %y) {
+; CHECK-LABEL: @mul_nonzero_contains_nonzero_mul(
+; CHECK-NEXT: [[XX:%.*]] = or i8 [[X:%.*]], 16
+; CHECK-NEXT: [[YY:%.*]] = or i8 [[Y:%.*]], 8
+; CHECK-NEXT: [[XY:%.*]] = mul i8 [[XX]], [[YY]]
+; CHECK-NEXT: [[NZ:%.*]] = icmp ne i8 [[XY]], 0
+; CHECK-NEXT: ret i1 [[NZ]]
+;
+ %xx = or i8 %x, 16
+ %yy = or i8 %y, 8
+ %xy = mul i8 %xx, %yy
+ %nz = icmp ne i8 %xy, 0
+ ret i1 %nz
+}
+
+define i1 @src_mul_maybe_zero_no_nonzero_mul(i8 %x, i8 %y) {
+; CHECK-LABEL: @src_mul_maybe_zero_no_nonzero_mul(
+; CHECK-NEXT: [[XX:%.*]] = or i8 [[X:%.*]], 96
+; CHECK-NEXT: [[YY:%.*]] = or i8 [[Y:%.*]], 8
+; CHECK-NEXT: [[XY:%.*]] = mul i8 [[XX]], [[YY]]
+; CHECK-NEXT: [[NZ:%.*]] = icmp ne i8 [[XY]], 0
+; CHECK-NEXT: ret i1 [[NZ]]
+;
+ %xx = or i8 %x, 96
+ %yy = or i8 %y, 8
+ %xy = mul i8 %xx, %yy
+ %nz = icmp ne i8 %xy, 0
+ ret i1 %nz
+}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150424.522376.patch
Type: text/x-patch
Size: 1236 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230515/d37aa747/attachment.bin>
More information about the llvm-commits
mailing list