[PATCH] D149414: [ValueTracking] Add logic for `isKnownNonZero(sadd.sat X, Y)`
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 29 10:21:37 PDT 2023
nikic added inline comments.
================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2940
+ II->getArgOperand(0), II->getArgOperand(1),
+ /*NSW*/ false);
case Intrinsic::uadd_sat:
----------------
I think you can set NSW=true here, based on the following reasoning: If the addition were to overflow, then the result would be either SignedMin or SignedMax, neither of which is zero. As such, we can ignore overflow cases.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D149414/new/
https://reviews.llvm.org/D149414
More information about the llvm-commits
mailing list