[PATCH] D149416: [ValueTracking] Add logic for `isKnownNonZero(umin X, Y)`
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 29 11:42:58 PDT 2023
goldstein.w.n updated this revision to Diff 518211.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149416/new/
https://reviews.llvm.org/D149416
Files:
llvm/lib/Analysis/ValueTracking.cpp
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
@@ -990,10 +990,7 @@
; CHECK-NEXT: call void @llvm.assume(i1 [[X_NZ]])
; CHECK-NEXT: [[Y_NZ:%.*]] = icmp ne i8 [[YY:%.*]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[Y_NZ]])
-; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.umin.i8(i8 [[XX]], i8 [[YY]])
-; CHECK-NEXT: [[Z:%.*]] = or i8 [[X]], [[IND:%.*]]
-; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[Z]], 0
-; CHECK-NEXT: ret i1 [[R]]
+; CHECK-NEXT: ret i1 false
;
%x_nz = icmp ne i8 %xx, 0
call void @llvm.assume(i1 %x_nz)
@@ -1028,10 +1025,7 @@
; CHECK-NEXT: call void @llvm.assume(i1 [[X_NZ]])
; CHECK-NEXT: [[Y_NZ:%.*]] = icmp ne i8 [[YY:%.*]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[Y_NZ]])
-; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.umin.i8(i8 [[XX]], i8 [[YY]])
-; CHECK-NEXT: [[Z:%.*]] = or i8 [[X]], [[IND:%.*]]
-; CHECK-NEXT: [[R:%.*]] = icmp eq i8 [[Z]], 0
-; CHECK-NEXT: ret i1 [[R]]
+; CHECK-NEXT: ret i1 false
;
%x_nz = icmp ne i8 %xx, 0
call void @llvm.assume(i1 %x_nz)
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -2952,6 +2952,9 @@
isKnownNonZero(II->getArgOperand(1), DemandedElts, Depth, Q))
return true;
break;
+ case Intrinsic::umin:
+ return isKnownNonZero(II->getArgOperand(0), DemandedElts, Depth, Q) &&
+ isKnownNonZero(II->getArgOperand(1), DemandedElts, Depth, Q);
case Intrinsic::cttz:
return computeKnownBits(II->getArgOperand(0), DemandedElts, Depth, Q)
.Zero[0];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149416.518211.patch
Type: text/x-patch
Size: 1876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230429/4591a71a/attachment-0001.bin>
More information about the llvm-commits
mailing list