[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
Thu May 11 22:04:55 PDT 2023


goldstein.w.n created this revision.
goldstein.w.n added reviewers: nikic, spatel, StephenFan, holland11.
Herald added a project: All.
goldstein.w.n requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

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 [[X]], 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 %x, 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 [[X]], 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 %x, 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.521553.patch
Type: text/x-patch
Size: 1228 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230512/4cec00b6/attachment.bin>


More information about the llvm-commits mailing list