[llvm] [KnownBits] Make nuw and nsw support in computeForAddSub optimal (PR #83382)

via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 22:35:06 PST 2024


================
@@ -2318,7 +2321,11 @@ static bool isNonZeroRecurrence(const PHINode *PN) {
 
 static bool isNonZeroAdd(const APInt &DemandedElts, unsigned Depth,
                          const SimplifyQuery &Q, unsigned BitWidth, Value *X,
-                         Value *Y, bool NSW) {
+                         Value *Y, bool NSW, bool NUW) {
+  if (NUW)
+    return isKnownNonZero(Y, DemandedElts, Depth, Q) ||
+           isKnownNonZero(X, DemandedElts, Depth, Q);
----------------
goldsteinn wrote:

not sure what your are getting at. None of the callsites have WithCache/knownbits computed beforehand.

https://github.com/llvm/llvm-project/pull/83382


More information about the llvm-commits mailing list