[llvm] b65ab0b - [ValueTracking] Add comment clarifying missing `usub.sat` in `isKnownNonZero`; NFC
Noah Goldstein via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 8 21:34:04 PDT 2024
Author: Noah Goldstein
Date: 2024-04-08T23:33:06-05:00
New Revision: b65ab0b726ce421cc6cd7fdfbf51bf4aba17ce87
URL: https://github.com/llvm/llvm-project/commit/b65ab0b726ce421cc6cd7fdfbf51bf4aba17ce87
DIFF: https://github.com/llvm/llvm-project/commit/b65ab0b726ce421cc6cd7fdfbf51bf4aba17ce87.diff
LOG: [ValueTracking] Add comment clarifying missing `usub.sat` in `isKnownNonZero`; NFC
Closes #87700
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index d50ccd8af287d8..6602db424fc260 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -2816,6 +2816,8 @@ static bool isKnownNonZeroFromOperator(const Operator *I,
case Intrinsic::bswap:
case Intrinsic::ctpop:
return isKnownNonZero(II->getArgOperand(0), DemandedElts, Depth, Q);
+ // NB: We don't do usub_sat here as in any case we can prove its
+ // non-zero, we will fold it to `sub nuw` in InstCombine.
case Intrinsic::ssub_sat:
return isNonZeroSub(DemandedElts, Depth, Q, BitWidth,
II->getArgOperand(0), II->getArgOperand(1));
More information about the llvm-commits
mailing list