The logic here is the same for add so reuse the existing helper
isNonZeroAdd
Alive2 Link:
https://alive2.llvm.org/ce/z/mhKvC5
Differential D149414
[ValueTracking] Add logic for `isKnownNonZero(sadd.sat X, Y)` goldstein.w.n on Apr 27 2023, 11:20 PM. Authored by
Details The logic here is the same for add so reuse the existing helper Alive2 Link: https://alive2.llvm.org/ce/z/mhKvC5
Diff Detail
Unit Tests
Event Timeline
|
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.