[llvm] [KnownBits] Make nuw and nsw support in computeForAddSub optimal (PR #83382)
via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 2 09:25:33 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:
This is pretty NFC. The callsites where all checking this manually before handle. Since we want NUW in `isAddNonZero` seemed to just make sense. But no strong feelings
https://github.com/llvm/llvm-project/pull/83382
More information about the llvm-commits
mailing list