[PATCH] D149414: [ValueTracking] Add logic for `isKnownNonZero(sadd.sat X, Y)`
Noah Goldstein via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 29 11:42:40 PDT 2023
goldstein.w.n updated this revision to Diff 518209.
goldstein.w.n added a comment.
Rebase
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149414/new/
https://reviews.llvm.org/D149414
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
@@ -920,10 +920,7 @@
; CHECK-NEXT: [[Y_POS:%.*]] = icmp sge i8 [[YY:%.*]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[X_STRICT_POS]])
; CHECK-NEXT: call void @llvm.assume(i1 [[Y_POS]])
-; CHECK-NEXT: [[X:%.*]] = call i8 @llvm.sadd.sat.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_strict_pos = icmp sgt i8 %xx, 0
%y_pos = icmp sge i8 %yy, 0
Index: llvm/lib/Analysis/ValueTracking.cpp
===================================================================
--- llvm/lib/Analysis/ValueTracking.cpp
+++ llvm/lib/Analysis/ValueTracking.cpp
@@ -2942,6 +2942,10 @@
std::optional<bool> ugt = KnownBits::ugt(XKnown, YKnown);
return ugt && *ugt;
}
+ case Intrinsic::sadd_sat:
+ return isNonZeroAdd(DemandedElts, Depth, Q, BitWidth,
+ II->getArgOperand(0), II->getArgOperand(1),
+ /*NSW*/ false);
case Intrinsic::uadd_sat:
if (isKnownNonZero(II->getArgOperand(0), DemandedElts, Depth, Q) ||
isKnownNonZero(II->getArgOperand(1), DemandedElts, Depth, Q))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149414.518209.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230429/f744730b/attachment.bin>
More information about the llvm-commits
mailing list